当前位置: 首页 > 图文教程 > 网络编程 > PHP > 聊天室php&mysql(二)

PHP
php,不用COM,生成excel文件
无限级别菜单的实现
如何过滤高亮显示非法字符
PHP实现的功能是显示8条基色色带
PHP模拟SQL Server的两个日期处理函数
用PHP连接Oracle数据库
PHP 和 MySQL 开发的 8 个技巧
PHP4在WinXP下IIS和Apache2服务器上的安装实例
如何对PHP程序中的常见漏洞进行攻击(上)
桌面中心(三)修改数据库
桌面中心(二)数据库写入
桌面中心(一)创建数据库
桌面中心(四)数据显示
玩转虚拟域名◎+ .
如何分别全角和半角以避免乱码
如何去掉文章里的 html 语法
PHP 增加了对 .ZIP 文件的读取功能
配置PHP使之能同时支持GIF和JPEG
使用php+xslt在windows平台上
图象函数中的中文显示

PHP 中的 聊天室php&mysql(二)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 86 ::
收藏到网摘: n/a

//第二页面 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" style="position:absolute; left:9px; top:37px; width:94px; height:21px; z-index:1">
<div align="center"><font color="#FF9999"><b>在线人数</b></font></div>
</div>
<div id="Layer2" style="position:absolute; left:14px; top:96px; width:105px; height:276px; z-index:2">
<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" style="position:absolute; left:20px; top:62px; width:74px; height:11px; z-index:3">
<div align="center"><font size="2" color="#FF9999">(<?echo $online ;?>人)</font></div>
</div>
<p> </p>
<p> </p>
</body>
</html>