Emotion. php3:
Code 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]