聊天室php&mysql(二)
2024-07-24 12:56:45
供稿:网友
//第二页面 name="frame2.php"
<?
include "../signup/mysql.php";
header("expires: sun, 28 dec 1997 09:32:45 gmt");
header("cache-control: no-cache, must-revalidate");
header("pragma: no-cache");
header("content-type: text/html; charset=${charset}");
$current_time=time();
$delete_time=$current_time-40;
$sql="delete from chat_user where last_time<".$delete_time;
mysql_query($sql)or die(" false again");
$sql="update chat_user set last_time='$current_time' where userid='$userid'";
mysql_query($sql) or die("false");
$sql="select userid from chat_user";
$result=mysql_query($sql)or die("fallse");
$online=mysql_num_rows($result);
?>
<html>
<head>
<title>user list</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<meta http-equiv="refresh" content="30; url=<? echo $php_self; ?>?userid=<?echo $userid?>">
</head>
<body bgcolor="#6699ff" text="#000000">
<div id="layer1" >
<div align="center"><font color="#ff9999"><b>在线人数</b></font></div>
</div>
<div id="layer2" >
<p><i><font size="2" color="#ff9999">
<?
$sql="select userid,id,sex from chat_user";
$result=mysql_query($sql)or die("fallse");
while($row=mysql_fetch_array($result)){
$user=$row['userid'];
$user="<a href='".$php_self."?userid=".$userid."' onclick=parent.bottom.user('".$row["id"]."')>".$row["id"];
echo $user."</a>(".$row["sex"].")<br>";
}
?>
</font></i></p>
<p> </p>
</div>
<div id="layer3" >
<div align="center"><font size="2" color="#ff9999">(<?echo $online ;?>人)</font></div>
</div>
<p> </p>
<p> </p>
</body>
</html>
国内最大的酷站演示中心!