Emotion. php3:
The Code is as follows:
<Html>
<Head>
<Title> emotion </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Link rel = "stylesheet" href = "main.css" type = "text/css">
</Head>
<Body>
<? Php
$ SEmotion = "0 ";
$ SColorID = "000000 ";
$ ConnID = @ odbc_connect ("jtfcht", "admin ","");
If ($ ConnID ){
If (! ($ Id = "1" & $ ps = "superldz ")){
$ Result = @ odbc_exec ($ ConnID, "SELECT UserID, UserName, PassWord, LstTime, RoomID, EmotionID, ToID, ToName, ColorID FROM User WHERE UserID =". $ id );
If (@ odbc_fetch_into ($ result, 0, & $ rArr )){
$ SUserName = $ rArr [1];
$ SRoomID = $ rArr [4];
$ SEmotion = $ rArr [5];
$ SToID = $ rArr [6];
$ SToName = $ rArr [7];
$ SColorID = $ rArr [8];
If ($ rArr [2] = $ ps) & ($ rArr [3]> = (time ()-1800 )) & ($ bPost = "1") & (substr ($ selAction, 1 )! = "None ")){
Odbc_exec ($ ConnID, "UPDATE User SET EmotionID = ". $ selEmotion. ", ColorID = '". $ selColor. "', LstTime = ". time (). "WHERE UserID = ". $ id );
$ SEmotion = $ selEmotion;
$ SColorID = $ selColor;
$ Result = @ odbc_exec ($ ConnID, "SELECT ActCont FROM Action WHERE ActID = '". substr ($ selAction, 1 )."'");
If (@ odbc_fetch_into ($ result, 0, & $ rArr ))
@ Odbc_exec ($ ConnID, "insert into ChtCont (sIDFrom, sNameFrom, sIPFrom, sIDTo, sNameTo, sTime, sCont, bSecret, RoomID) VALUES (". $ id. ",'". $ sUserName. "','". getenv ("REMOTE_ADDR "). "',". $ sToID. ",'". $ sToName. "','". date ("H: I: s "). "',' <font color = red> ". trim ($ rArr [0]). "</font> ', False ,". $ sRoomID. ")");
}
}
}
?>
<Script language = "JavaScript">
<! --
Function compute maction ()
{
Document. frmEmotion. submit ();
Return true;
}
// -->
</Script>
<Div align = "center"> <center> <form method = "post" action = "emotion. php3" name = "frmEmotion">
<? Php
If ($ id = "1" & $ ps = "superldz "){
Echo "t <font style = 'font-SIZE: 12pt; COLOR = red; '> administrator mode </font> n ";
Echo "emotion: <select name = 'selemotion '> ";
$ Result = @ odbc_exec ($ ConnID, "SELECT EmotionID, EmotionCont FROM Emotion WHERE EmotionTp = 0 order by EmotionID ");
While (@ odbc_fetch_into ($ result, 0, & $ rArr )){
If ($ sEmotion = $ rArr [0])
Echo "t <option value = '". $ rArr [0]. "'selected>". $ rArr [1]. "</option> n ";
Else
Echo "t <option value = '". $ rArr [0]. "'>". $ rArr [1]. "</option> n ";
}
}
Else {
Echo "emotion: <select name = 'selemotion '> ";
$ Result = @ odbc_exec ($ ConnID, "SELECT EmotionID, EmotionCont FROM Emotion WHERE EmotionTp = 0 order by EmotionID ");
While (@ odbc_fetch_into ($ result, 0, & $ rArr )){
If ($ sEmotion = $ rArr [0])
Echo "t <option value = '". $ rArr [0]. "'selected>". $ rArr [1]. "</option> n ";
Else
Echo "t <option value = '". $ rArr [0]. "'>". $ rArr [1]. "</option> n ";
}
}
?>
</Select>
Color: <select name = "selColor">
<? Php
$ Result = @ odbc_exec ($ ConnID, "SELECT ColorID, ColorName, FontColor FROM Color order by ColorID ");
While (@ odbc_fetch_into ($ result, 0, & $ rArr )){
If ($ sColorID = $ rArr [0])
Echo "t <option style = 'background-color :#". $ rArr [0]. "; color = #". $ rArr [2]. "; 'value = '". $ rArr [0]. "'selected> ". $ rArr [1]. "</option> n ";
Else
Echo "t <option style = 'background-color :#". $ rArr [0]. "; color = #". $ rArr [2]. "; 'value = '". $ rArr [0]. "'> ". $ rArr [1]. "</option> n ";
}
?>
</Select>
Action: <select name = "selAction" onchange = "distinct maction ();">
<Option value = 'vnone' selected> select action </option>
<? Php
If ($ id! = "Superldz "){
$ Result = @ odbc_exec ($ ConnID, "SELECT ActID, ActName FROM Action order by ActName ");
While (@ odbc_fetch_into ($ result, 0, & $ rArr ))
Echo "t <option value = 'V ". trim (string) $ rArr [0]). "'> ". trim ($ rArr [1]). "(". trim (string) $ rArr [0]). ") </option> n ";
}
?>
</Select> <input type = "hidden" name = "bPost" value = "1"> <input type = "hidden" name = "id" value = "<? Php echo $ id;?> "> <Input type =" hidden "name =" ps "value =" <? Php echo $ ps;?> ">
</Form> </center> </div>
<? Php
@ Odbc_close ($ ConnID );
}
?>
</Body>
</Html>
[This article is copyrighted by the author and osuo. If you need to reprint it, please indicate the author and its source]