function send2(who,towho,time,pic,biaoqing){
parent.bottom.scroll(0, 65000);
parent.bottom.document.write("<html><body bgcolor='#F8F9EE'></html>");
parent.bottom.document.write("<html><img src='"+biaoqing+"' border=0 width=15></html>");
parent.bottom.document.write("<html><body>"+who+"<font size=3 color=#ff0000>送给"+"<a href=javascript:parent.talkto('"+towho+"') target=input><ACRONYM TITLE='选取 "+towho+" 为谈话对象'>"+towho+"</a>一件珍贵的</font><img src='gift/"+pic+"' border=0><font color=#ff0000 size=-1>&nbsp;&nbsp;("+time+")</font></body></html>");
parent.bottom.document.write("<br>");
parent.bottom.scroll(0, 65000);
}
</script><meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312"><body bgcolor="#deebff">
<body topmargin="0">
<?php$result=mysql_query("select * from hbw where room='$room'");
$rn=mysql_num_rows($result)-1;print "欢迎光临小毛驴聊天室<br>";
$delaytime=0;
$delaytime1=0;
//循环
while(1)
{
$t = date("H:i:s");
//延迟1秒钟sleep(1);
$delaytime=$delaytime+1;
//时间标记增加
$delaytime1=$delaytime1+1;if($delaytime>60){
$query=mysql_query("insert into hbw values('j','','','','','*','','','','$room','')");
$delaytime=0;
$ttttt=1;
}
//如果时间标记快到允许的脚本运行时间则退出循环
if($delaytime1>2500){
break;
}$result=mysql_query("select * from hbw where room='$room'");
$rn1=mysql_num_rows($result);//如果有新的发言则退出循环
if($rn!=$rn1 ) {$result=mysql_query("select * from hbw where room='$room'");
$rn1=mysql_num_rows($result);
$al=$rn1-$rn;
$query=mysql_query("select * from hbw where room=$room order by id desc limit $al");
while($lin=mysql_fetch_array($query)){
$biaoqing="./biaoqing/".$lin[10].".gif";$qu=mysql_query("select count(*) from friendhi where nameh='$name' and name='$lin[2]'");
$forbiden=mysql_result($qu,0);
if ($forbiden>0){continue;}
if($name==$lin[1]){
$to="<font color='#FF0000' size=3><b>●●<u>".$lin[1]."</u></b></font>";
}
else{
$to="<a href=\"javascript:parent.talkto('$lin[1]')\" target='input'><ACRONYM TITLE='选取 ".$lin[1]." 为谈话对象'>"."<font size=3>".$lin[1]."</font>"."</ACRONYM></a>";
}
if($name==$lin[2]){
$wo="<font color='#800000' size=2>$lin[2] [自己]</font>";
}else{
$wo="<a href=\"javascript:parent.talkto('$lin[2]')\" target='input'><ACRONYM TITLE='选取 ".$lin[2]." 为谈话对象'><font size=3>".$lin[2]."</font></ACRONYM></a>";
}
$etom="对".$to.$lin[3];
$temp=substr($lin[5],0,2);
if ($temp=="//"){
$say=addslashes($lin[5]);
$q=mysql_query("select * from emote where command=\"$say\"");
$rowa=mysql_fetch_row($q);
$row=$rowa[1];
if ($row) { $lin[5]=str_replace("对象",$to,$row);
$etom="";}
}$temp1=substr($lin[5],0,3);
if ($temp1=="/-/"){
$gift=substr($lin[5],3,strlen($lin[5])-3);
$biaoji3="送给".$to."一件珍贵的<img src=gift/".$gift.">";
$etom="";
}else{$biaoji3=$lin[5];}if($lin[0]=="j" and $ttttt==1){
echo "<font size=-2>$biaoji3</font>";
$ttttt=0;
}if(($lin[0]=="n" or $lin[0]=="s") and $lin[1]==$name and ($temp!="//" and $temp1!="/-/")){
echo "<script>send('$lin[2]','$lin[1]','$lin[5]','$lin[3]','$lin[4]','$lin[7]','$biaoqing');</script>";
}
if(($lin[0]=="n" or $lin[0]=="s") and $lin[2]==$name and ($temp!="//" and $temp1!="/-/")){
echo "<script>send1('$lin[2]','$lin[1]','$lin[5]','$lin[3]','$lin[4]','$lin[7]','$biaoqing');</script>";
}
if(($lin[0]=="n") and ($lin[1]==$name or $lin[2]==$name) and $temp1=="/-/"){
echo "<script>send2('$lin[2]','$lin[1]','$lin[7]','$gift','$biaoqing');</script>";
}if ($lin[0]=="i"){
$ttt=1;
echo "<font color=red size=2>【系统提示】</font>$wo<font color=#008000 size=2>进入聊天室!</font> <font color='#808080' size=-1>($lin[7])</font><br>";}
elseif ($lin[0]=="o"){
$ttt=1;
echo "<font color=#aaaaaa size=2>【系统提示】<b>$lin[2]</b>离开聊天室! <font color='#808080' size=-1>($lin[7])</font></font><br>";}
/*
elseif ($lin[0]=="q"){
$ttt=1;
echo "<font color=#aaaaaa size=2>【系统提示】$wo 清除掉聊天记录! <font color='#808080' size=-1>($lin[7])</font></font><br>";}*/
elseif ($lin[0]=="t"){
if ($lin[2]==$name)
{ mysql_query("delete from online where name='$name' and room=$room");
echo "<script>alert('因为你说话不文明,被管理员踢出聊天室')</script>";echo "<script src='f3.js'></script>";}
$ttt=1;
echo "<font color=#aaaaaa size=2>【系统提示】<b>$lin[2]</b>因不遵守聊天规则,被 $to 踢出聊天室! <font color='#808080' size=-1>($lin[7])</font></font><br>";
}
elseif ($lin[0]=="g" || $lin[0]=="k"){
if ($lin[1]==$name && $lin[0]=="g")
{echo "<script>sended($lin[6],'$lin[2]');</script>";
mysql_query("update hbw set type='k' where id='$lin[8]' and room=$room");}
$ttt=1;
echo "∮$wo 点了一首 $lin[5] 给$to 听......<br>";
}
elseif ($lin[0]=='c'){
$ttt=1;
echo "<font color=#aaaaaa size=2>【系统提示】<font size=-1 color='#008080'>$lin[2]</font>操作超时了,重重地摔了下去! <font color='#808080' size=-1>($lin[7])</font></font><br>";
}
elseif ($lin[0]==n){
$ttt=1;
if ($temp1=="/-/"){
echo "<img src=$biaoqing border=0 width=17>$wo$etom<font color=$lin[4]>$biaoji3 <font face=wingdings>$lin[6]</font> <font color='#808080' size=-1>($lin[7])</font></font><br>";
}else{
echo "<img src=$biaoqing border=0 width=17>$wo$etom<font color=$lin[4]>$lin[5] <font face=wingdings>$lin[6]</font> <font color='#808080' size=-1>($lin[7])</font></font><br>";
}}
elseif ($lin[1]==$name || $lin[2]==$name){
$ttt=1;
echo "☆☆<img src=$biaoqing border=0 width=17>$wo$etom<font color=$lin[4]>$lin[5] <font face=wingdings>$lin[6]</font> <font color='#808080' size=-1>($lin[7])</font></font><br>";}
}flush();
mysql_free_result($result); #释放数据库结果占用的内存 ,不然数据库会崩溃
$rn=$rn1;
if($ttt==1){$delaytime=0;}
$ttt=0;
$lay=1;
}
}
?><p>&nbsp;</p><meta http-equiv="Refresh" content="1; url=./view.php?name=<? echo $name; ?>&amp;room=<? echo $room; ?>&amp;rn=<? echo $rn1; ?>&amp;alzhan=2%3E"></body>
</html>