用PHP和ACCESS写聊天室(三)
程序员文章站
2022-10-05 22:52:11
cinput.php3 如下: 输入
cinput.php3
如下:
<html>
<head>
<title>输入</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="main.css" type="text/css">
<script language="javascript">
<!--
function namegotfocus( ) {
document.frminput.txtsend.focus();
}
function checkvalid() {
document.frminput.semotion.value=top.emotion.frmemotion.selemotion.value;
document.frminput.scolor.value=top.emotion.frmemotion.selcolor.value;
if (document.frminput.txtsend.value == "") {
document.frminput.txtsend.focus();
return false;
}
return true;
}
//-->
</script>
<link rel="stylesheet" href="main.css" type="text/css">
</head>
<body onload="namegotfocus()">
<?php
function suiji($max){
srand((double)microtime()*1000000);
$x=rand();
$y=getrandmax();
$r=$x/$y*($max-1);
$r=round($r++);
return $r;
}
function stroccurs($sstr, $sfind){
$stemp=$sstr;
$ilen=strlen($sfind);
$icount=0;
while (true){
if (strstr($stemp, $sfind))
break;
else{
$stemp = substr($stemp,strpos($stemp,$sfind)+$ilen);
$icount++;
}
}
return $icount;
}
function strdupl($sstr, $icnt){
$ret="";
for($i=1;$i<=$icnt;$i++)
$ret.=$sstr;
return $ret;
}
function delquot($sstr){
$s=str_replace(chr(124),"¦",$sstr);
$s=str_replace(chr(39),"´",$s);
$s=str_replace(chr(34),""",$s);
return $s;
}
function deltag($sstr){
$bneed="false";
$sother=strtoupper($sstr);
if ($bneed!="true" || !strstr($sother,"<table")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</table")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<script")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</script")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<body")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</body")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<html")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</html")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<head")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</head")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<form")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</form")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<input")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</input")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<option")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</option")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<select")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</select")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<applet")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</applet")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<object")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</object")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<menu")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</menu")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<frameset")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</frameset")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<frame")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</frame")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<iframe")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</iframe")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<style")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</style")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<base")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"font-size:")) $bneed="true";
if ($bneed=="true")
return str_replace(">",">",str_replace("<","<",$sstr));
else
return $sstr;
}
function addlost($sstr){
$ret=$sstr;
$ret.=strdupl(">", (stroccurs(strtoupper($ret), "<") - stroccurs(strtoupper($ret), ">")));
$ret.=strdupl("</font>", (stroccurs(strtoupper($ret), "<font") - stroccurs(strtoupper($ret), "</font>")));
$ret.=strdupl("</b>", (stroccurs(strtoupper($ret), "<b") - stroccurs(strtoupper($ret), "</b>")));
$ret.=strdupl("</i>", (stroccurs(strtoupper($ret), "<i") - stroccurs(strtoupper($ret), "</i>")));
$ret.=strdupl("</u>", (stroccurs(strtoupper($ret), "<u") - stroccurs(strtoupper($ret), "</u>")));
$ret.=strdupl("</s>", (stroccurs(strtoupper($ret), "<s") - stroccurs(strtoupper($ret), "</s>")));
$ret.=strdupl("</strike>", (stroccurs(strtoupper($ret), "<strike") - stroccurs(strtoupper($ret), "</strike>")));
$ret.=strdupl("</strong>", (stroccurs(strtoupper($ret), "<strong") - stroccurs(strtoupper($ret), "</strong>")));
$ret.=strdupl("</small>", (stroccurs(strtoupper($ret), "<small") - stroccurs(strtoupper($ret), "</small>")));
$ret.=strdupl("</cite>", (stroccurs(strtoupper($ret), "<cite") - stroccurs(strtoupper($ret), "</cite>")));
$ret.=strdupl("</em>", (stroccurs(strtoupper($ret), "<em") - stroccurs(strtoupper($ret), "</em>")));
$ret.=strdupl("</code>", (stroccurs(strtoupper($ret), "<code") - stroccurs(strtoupper($ret), "</code>")));
$ret.=strdupl("</samp>", (stroccurs(strtoupper($ret), "<samp") - stroccurs(strtoupper($ret), "</samp>")));
$ret.=strdupl("</kbd>", (stroccurs(strtoupper($ret), "<kbd") - stroccurs(strtoupper($ret), "</kbd>")));
$ret.=strdupl("</var>", (stroccurs(strtoupper($ret), "<var") - stroccurs(strtoupper($ret), "</var>")));
$ret.=strdupl("</dfn>", (stroccurs(strtoupper($ret), "<dfn") - stroccurs(strtoupper($ret), "</dfn>")));
$ret.=strdupl("</big>", (stroccurs(strtoupper($ret), "<big") - stroccurs(strtoupper($ret), "</big>")));
$ret.=strdupl("</sup>", (stroccurs(strtoupper($ret), "<sup") - stroccurs(strtoupper($ret), "</sup>")));
$ret.=strdupl("</sub>", (stroccurs(strtoupper($ret), "<sub") - stroccurs(strtoupper($ret), "</sub>")));
$ret.=strdupl("</h1>", (stroccurs(strtoupper($ret), "<h1") - stroccurs(strtoupper($ret), "</h1>")));
$ret.=strdupl("</h2>", (stroccurs(strtoupper($ret), "<h2") - stroccurs(strtoupper($ret), "</h2>")));
$ret.=strdupl("</h3>", (stroccurs(strtoupper($ret), "<h3") - stroccurs(strtoupper($ret), "</h3>")));
$ret.=strdupl("</h4>", (stroccurs(strtoupper($ret), "<h4") - stroccurs(strtoupper($ret), "</h4>")));
$ret.=strdupl("</h5>", (stroccurs(strtoupper($ret), "<h5") - stroccurs(strtoupper($ret), "</h5>")));
$ret.=strdupl("</h6>", (stroccurs(strtoupper($ret), "<h6") - stroccurs(strtoupper($ret), "</h6>")));
$ret.=strdupl("</h7>", (stroccurs(strtoupper($ret), "<h7") - stroccurs(strtoupper($ret), "</h7>")));
return $ret;
}
$ssecret="false";
$srefrate=5;
$connid=@odbc_connect("jtfcht","admin","");
if ($connid){
if ($id=="1" && $ps="superldz"){
$result=@odbc_exec($connid,"select refrate from user where userid=".$id);
if (@odbc_fetch_into($result,0,&$rarr)){
$srefrate=$rarr[0];
if ($cmdsend=="送出"){
$srefrate=(int)($txtrefrate);
if ($srefrate<2) $srefrate=2;
@odbc_exec($connid,"update user set refrate=".$srefrate.",lsttime=".time()." where userid=".($id));
@odbc_exec($connid,"insert into chtcont (sidfrom, snamefrom, sipfrom, sidto, snameto, stime, scont, bsecret, roomid) values (".$id.", '管理员', '".getenv("remote_addr")."', 0, '大家', '".date("h:i:s")."', '<font color=gray>【系统消息】".trim(delquot(htmlspecialchars($txtsend)))."</font>', false, 0)");
}
}
}
else{
$result=@odbc_exec($connid,"select userid,username,password,lsttime,secret,refrate,toid,toname,roomid from user where userid=".($id));
if (@odbc_fetch_into($result,0,&$rarr)){
if ($rarr[2]==$ps){
if ($rarr[3]>=(time()-1800)){
if ($rarr[4]) $ssecret="true";
$srefrate=$rarr[5];
if ($cmdsend=="送出"){
$susername=$rarr[1];
$stoid=$rarr[6];
$stoname=$rarr[7];
$sroomid=$rarr[8];
//$ssend=addlost(deltag(delquot($txtsend)));
$ssend=delquot(htmlspecialchars($txtsend));
if ($chksecret=="yes"){
$ssecret="true";
$stalk="悄悄说:";
}
else{
$ssecret="false";
$stalk="说:";
}
$srefrate=(int)($txtrefrate);
if ($srefrate<2) $srefrate=2;
@odbc_exec($connid,"update user set emotionid=".$semotion.",colorid='".$scolor."',secret=".$ssecret.",refrate=".$srefrate.",lsttime=".time()." where userid=".$id);
$bcht="true";
$btome="false";
if (substr($ssend,0,3)=="/t "){
$schtcont="<font color=blue><i>%m想".substr($ssend,3)."</i></font>";
$ssecret="false";
$bcht="false";
}
elseif (substr($ssend,0,3)=="/: "){
$schtcont="<font color=red>%m".substr($ssend,3)."</font>";
$ssecret="false";
$bcht="false";
}
elseif (strtolower(substr($ssend,0,3))=="/w "){
$result=@odbc_exec($connid,"select roomid from user where username='".trim(substr($ssend,3))."'");
if (@odbc_fetch_into($result,0,&$rarr)){
if ($rarr[0]>0){
$result=@odbc_exec($connid,"select roomname from room where roomid=".$rarr[0]);
if (@odbc_fetch_into($result,0,&$rarr))
$schtcont="<font color=gray>【系统消息】".trim(substr($ssend,3))."目前在房间".$rarr[0]."。</font>";
else
$schtcont="<font color=gray>【系统消息】系统混乱了,".trim(substr($ssend,3))."目前在的房间不可识别!</font>";
}
else
$schtcont="<font color=gray>【系统消息】".trim(substr($ssend,3))."目前没有上线。</font>";
$ssecret="true";
$bcht="false";
}
else{
$schtcont="<font color=gray>【系统消息】没有".trim(substr($ssend,3))."这个人。</font>";
$ssecret="true";
$bcht="false";
}
$btome="true";
}
elseif (substr($ssend,0,3)=="// "){
$result=@odbc_exec($connid,"select actcont from action where actid='".trim(substr($ssend,3))."'");
if (@odbc_fetch_into($result,0,&$rarr)){
$schtcont="<font color=red>".trim($rarr[0])."</font>";
$ssecret="false";
$bcht="false";
}
else $bcht="true";
}
if ($bcht=="true"){
$result=@odbc_exec($connid,"select count(emotiontp) as cnt_tp from emotion where emotiontp=".$semotion);
@odbc_fetch_into($result,0,&$rarr);
if ($rarr[0]>0){
$iemcnt=suiji($rarr[0]);
$result=@odbc_exec($connid,"select emotioncont from emotion where emotiontp=".$semotion." and emotionid=".$iemcnt);
if (@odbc_fetch_into($result,0,&$rarr))
$schtcont="%m".trim($rarr[0])."对%g".$stalk.$ssend;
else
$schtcont="%m对%g".$stalk.$ssend;
}
else $schtcont="%m对%g".$stalk.$ssend;
if ($ssecret=="true")
$schtcont="<font color=green>".$schtcont."</font>";
else
$schtcont="<font color=#".$scolor.">".$schtcont."</font>";
}
if ($btome=="true")
@odbc_exec($connid,"insert into chtcont (sidfrom, snamefrom, sipfrom, sidto, snameto, stime, scont, bsecret, roomid) values (0, '大家', '".getenv("remote_addr")."', ".$id.", '".$susername."', '".date("h:i:s")."', '".$schtcont."', ".$ssecret.", ".$sroomid.")");
else
@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")."', '".$schtcont."', ".$ssecret.", ".$sroomid.")");
}
}
}
}
}
@odbc_close($connid);
}
?>
<div align="center"><center><form method="post" action="cinput.php3" name="frminput" onsubmit="return checkvalid();">
<input type="hidden" name="semotion" value="0"><input type="hidden" name="scolor" value="000000">
<?php
if ($ssecret=="true")
echo "t<input type="checkbox" name="chksecret" value="yes" checked>悄悄话n";
else
echo "t<input type="checkbox" name="chksecret" value="yes">悄悄话n";
?>
<input type="text" name="txtsend" maxlength="120" size="39"><input type="hidden" name="id" value="<?php echo $id; ?>"><input type="hidden" name="ps" value="<?php echo $ps; ?>">
<input type="submit" name="cmdsend" value="送出">
刷新:<input type="text" name="txtrefrate" maxlength="2" size="2" value="<?php echo $srefrate; ?>">
<input type="button" name="cmdexit" onclick="parent.location='leave.php3?id=<?php echo $id; ?>&ps=<?php echo $ps; ?>&at=<?php echo time(); ?>'" value="退出">
</form></center></div>
</body>
</html>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
如下:
<html>
<head>
<title>输入</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="main.css" type="text/css">
<script language="javascript">
<!--
function namegotfocus( ) {
document.frminput.txtsend.focus();
}
function checkvalid() {
document.frminput.semotion.value=top.emotion.frmemotion.selemotion.value;
document.frminput.scolor.value=top.emotion.frmemotion.selcolor.value;
if (document.frminput.txtsend.value == "") {
document.frminput.txtsend.focus();
return false;
}
return true;
}
//-->
</script>
<link rel="stylesheet" href="main.css" type="text/css">
</head>
<body onload="namegotfocus()">
<?php
function suiji($max){
srand((double)microtime()*1000000);
$x=rand();
$y=getrandmax();
$r=$x/$y*($max-1);
$r=round($r++);
return $r;
}
function stroccurs($sstr, $sfind){
$stemp=$sstr;
$ilen=strlen($sfind);
$icount=0;
while (true){
if (strstr($stemp, $sfind))
break;
else{
$stemp = substr($stemp,strpos($stemp,$sfind)+$ilen);
$icount++;
}
}
return $icount;
}
function strdupl($sstr, $icnt){
$ret="";
for($i=1;$i<=$icnt;$i++)
$ret.=$sstr;
return $ret;
}
function delquot($sstr){
$s=str_replace(chr(124),"¦",$sstr);
$s=str_replace(chr(39),"´",$s);
$s=str_replace(chr(34),""",$s);
return $s;
}
function deltag($sstr){
$bneed="false";
$sother=strtoupper($sstr);
if ($bneed!="true" || !strstr($sother,"<table")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</table")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<script")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</script")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<body")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</body")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<html")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</html")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<head")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</head")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<form")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</form")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<input")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</input")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<option")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</option")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<select")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</select")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<applet")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</applet")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<object")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</object")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<menu")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</menu")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<frameset")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</frameset")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<frame")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</frame")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<iframe")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</iframe")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<style")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"</style")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"<base")) $bneed="true";
if ($bneed!="true" || !strstr($sother,"font-size:")) $bneed="true";
if ($bneed=="true")
return str_replace(">",">",str_replace("<","<",$sstr));
else
return $sstr;
}
function addlost($sstr){
$ret=$sstr;
$ret.=strdupl(">", (stroccurs(strtoupper($ret), "<") - stroccurs(strtoupper($ret), ">")));
$ret.=strdupl("</font>", (stroccurs(strtoupper($ret), "<font") - stroccurs(strtoupper($ret), "</font>")));
$ret.=strdupl("</b>", (stroccurs(strtoupper($ret), "<b") - stroccurs(strtoupper($ret), "</b>")));
$ret.=strdupl("</i>", (stroccurs(strtoupper($ret), "<i") - stroccurs(strtoupper($ret), "</i>")));
$ret.=strdupl("</u>", (stroccurs(strtoupper($ret), "<u") - stroccurs(strtoupper($ret), "</u>")));
$ret.=strdupl("</s>", (stroccurs(strtoupper($ret), "<s") - stroccurs(strtoupper($ret), "</s>")));
$ret.=strdupl("</strike>", (stroccurs(strtoupper($ret), "<strike") - stroccurs(strtoupper($ret), "</strike>")));
$ret.=strdupl("</strong>", (stroccurs(strtoupper($ret), "<strong") - stroccurs(strtoupper($ret), "</strong>")));
$ret.=strdupl("</small>", (stroccurs(strtoupper($ret), "<small") - stroccurs(strtoupper($ret), "</small>")));
$ret.=strdupl("</cite>", (stroccurs(strtoupper($ret), "<cite") - stroccurs(strtoupper($ret), "</cite>")));
$ret.=strdupl("</em>", (stroccurs(strtoupper($ret), "<em") - stroccurs(strtoupper($ret), "</em>")));
$ret.=strdupl("</code>", (stroccurs(strtoupper($ret), "<code") - stroccurs(strtoupper($ret), "</code>")));
$ret.=strdupl("</samp>", (stroccurs(strtoupper($ret), "<samp") - stroccurs(strtoupper($ret), "</samp>")));
$ret.=strdupl("</kbd>", (stroccurs(strtoupper($ret), "<kbd") - stroccurs(strtoupper($ret), "</kbd>")));
$ret.=strdupl("</var>", (stroccurs(strtoupper($ret), "<var") - stroccurs(strtoupper($ret), "</var>")));
$ret.=strdupl("</dfn>", (stroccurs(strtoupper($ret), "<dfn") - stroccurs(strtoupper($ret), "</dfn>")));
$ret.=strdupl("</big>", (stroccurs(strtoupper($ret), "<big") - stroccurs(strtoupper($ret), "</big>")));
$ret.=strdupl("</sup>", (stroccurs(strtoupper($ret), "<sup") - stroccurs(strtoupper($ret), "</sup>")));
$ret.=strdupl("</sub>", (stroccurs(strtoupper($ret), "<sub") - stroccurs(strtoupper($ret), "</sub>")));
$ret.=strdupl("</h1>", (stroccurs(strtoupper($ret), "<h1") - stroccurs(strtoupper($ret), "</h1>")));
$ret.=strdupl("</h2>", (stroccurs(strtoupper($ret), "<h2") - stroccurs(strtoupper($ret), "</h2>")));
$ret.=strdupl("</h3>", (stroccurs(strtoupper($ret), "<h3") - stroccurs(strtoupper($ret), "</h3>")));
$ret.=strdupl("</h4>", (stroccurs(strtoupper($ret), "<h4") - stroccurs(strtoupper($ret), "</h4>")));
$ret.=strdupl("</h5>", (stroccurs(strtoupper($ret), "<h5") - stroccurs(strtoupper($ret), "</h5>")));
$ret.=strdupl("</h6>", (stroccurs(strtoupper($ret), "<h6") - stroccurs(strtoupper($ret), "</h6>")));
$ret.=strdupl("</h7>", (stroccurs(strtoupper($ret), "<h7") - stroccurs(strtoupper($ret), "</h7>")));
return $ret;
}
$ssecret="false";
$srefrate=5;
$connid=@odbc_connect("jtfcht","admin","");
if ($connid){
if ($id=="1" && $ps="superldz"){
$result=@odbc_exec($connid,"select refrate from user where userid=".$id);
if (@odbc_fetch_into($result,0,&$rarr)){
$srefrate=$rarr[0];
if ($cmdsend=="送出"){
$srefrate=(int)($txtrefrate);
if ($srefrate<2) $srefrate=2;
@odbc_exec($connid,"update user set refrate=".$srefrate.",lsttime=".time()." where userid=".($id));
@odbc_exec($connid,"insert into chtcont (sidfrom, snamefrom, sipfrom, sidto, snameto, stime, scont, bsecret, roomid) values (".$id.", '管理员', '".getenv("remote_addr")."', 0, '大家', '".date("h:i:s")."', '<font color=gray>【系统消息】".trim(delquot(htmlspecialchars($txtsend)))."</font>', false, 0)");
}
}
}
else{
$result=@odbc_exec($connid,"select userid,username,password,lsttime,secret,refrate,toid,toname,roomid from user where userid=".($id));
if (@odbc_fetch_into($result,0,&$rarr)){
if ($rarr[2]==$ps){
if ($rarr[3]>=(time()-1800)){
if ($rarr[4]) $ssecret="true";
$srefrate=$rarr[5];
if ($cmdsend=="送出"){
$susername=$rarr[1];
$stoid=$rarr[6];
$stoname=$rarr[7];
$sroomid=$rarr[8];
//$ssend=addlost(deltag(delquot($txtsend)));
$ssend=delquot(htmlspecialchars($txtsend));
if ($chksecret=="yes"){
$ssecret="true";
$stalk="悄悄说:";
}
else{
$ssecret="false";
$stalk="说:";
}
$srefrate=(int)($txtrefrate);
if ($srefrate<2) $srefrate=2;
@odbc_exec($connid,"update user set emotionid=".$semotion.",colorid='".$scolor."',secret=".$ssecret.",refrate=".$srefrate.",lsttime=".time()." where userid=".$id);
$bcht="true";
$btome="false";
if (substr($ssend,0,3)=="/t "){
$schtcont="<font color=blue><i>%m想".substr($ssend,3)."</i></font>";
$ssecret="false";
$bcht="false";
}
elseif (substr($ssend,0,3)=="/: "){
$schtcont="<font color=red>%m".substr($ssend,3)."</font>";
$ssecret="false";
$bcht="false";
}
elseif (strtolower(substr($ssend,0,3))=="/w "){
$result=@odbc_exec($connid,"select roomid from user where username='".trim(substr($ssend,3))."'");
if (@odbc_fetch_into($result,0,&$rarr)){
if ($rarr[0]>0){
$result=@odbc_exec($connid,"select roomname from room where roomid=".$rarr[0]);
if (@odbc_fetch_into($result,0,&$rarr))
$schtcont="<font color=gray>【系统消息】".trim(substr($ssend,3))."目前在房间".$rarr[0]."。</font>";
else
$schtcont="<font color=gray>【系统消息】系统混乱了,".trim(substr($ssend,3))."目前在的房间不可识别!</font>";
}
else
$schtcont="<font color=gray>【系统消息】".trim(substr($ssend,3))."目前没有上线。</font>";
$ssecret="true";
$bcht="false";
}
else{
$schtcont="<font color=gray>【系统消息】没有".trim(substr($ssend,3))."这个人。</font>";
$ssecret="true";
$bcht="false";
}
$btome="true";
}
elseif (substr($ssend,0,3)=="// "){
$result=@odbc_exec($connid,"select actcont from action where actid='".trim(substr($ssend,3))."'");
if (@odbc_fetch_into($result,0,&$rarr)){
$schtcont="<font color=red>".trim($rarr[0])."</font>";
$ssecret="false";
$bcht="false";
}
else $bcht="true";
}
if ($bcht=="true"){
$result=@odbc_exec($connid,"select count(emotiontp) as cnt_tp from emotion where emotiontp=".$semotion);
@odbc_fetch_into($result,0,&$rarr);
if ($rarr[0]>0){
$iemcnt=suiji($rarr[0]);
$result=@odbc_exec($connid,"select emotioncont from emotion where emotiontp=".$semotion." and emotionid=".$iemcnt);
if (@odbc_fetch_into($result,0,&$rarr))
$schtcont="%m".trim($rarr[0])."对%g".$stalk.$ssend;
else
$schtcont="%m对%g".$stalk.$ssend;
}
else $schtcont="%m对%g".$stalk.$ssend;
if ($ssecret=="true")
$schtcont="<font color=green>".$schtcont."</font>";
else
$schtcont="<font color=#".$scolor.">".$schtcont."</font>";
}
if ($btome=="true")
@odbc_exec($connid,"insert into chtcont (sidfrom, snamefrom, sipfrom, sidto, snameto, stime, scont, bsecret, roomid) values (0, '大家', '".getenv("remote_addr")."', ".$id.", '".$susername."', '".date("h:i:s")."', '".$schtcont."', ".$ssecret.", ".$sroomid.")");
else
@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")."', '".$schtcont."', ".$ssecret.", ".$sroomid.")");
}
}
}
}
}
@odbc_close($connid);
}
?>
<div align="center"><center><form method="post" action="cinput.php3" name="frminput" onsubmit="return checkvalid();">
<input type="hidden" name="semotion" value="0"><input type="hidden" name="scolor" value="000000">
<?php
if ($ssecret=="true")
echo "t<input type="checkbox" name="chksecret" value="yes" checked>悄悄话n";
else
echo "t<input type="checkbox" name="chksecret" value="yes">悄悄话n";
?>
<input type="text" name="txtsend" maxlength="120" size="39"><input type="hidden" name="id" value="<?php echo $id; ?>"><input type="hidden" name="ps" value="<?php echo $ps; ?>">
<input type="submit" name="cmdsend" value="送出">
刷新:<input type="text" name="txtrefrate" maxlength="2" size="2" value="<?php echo $srefrate; ?>">
<input type="button" name="cmdexit" onclick="parent.location='leave.php3?id=<?php echo $id; ?>&ps=<?php echo $ps; ?>&at=<?php echo time(); ?>'" value="退出">
</form></center></div>
</body>
</html>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】