采用行写方式的聊天程序(之二)
2000-12-10 16:27:45 来源:WEB开发网核心提示:lt1.php: 该程序为整个系统的入口,含有两个全局参数:chat_hh,uname分别记录当前最大的发言序号和发言者名称 <? session_start(); session_register("chat_hh"); session_register("uname")
lt1.php:
该程序为整个系统的入口,含有两个全局参数:chat_hh,uname分别记录当前最大的发言序号和发言者名称
<?
session_start();
session_register("chat_hh");
session_register("uname");
//取数据库最大编号
include("g_fun.php");
f_connectdb();
$query = "select max(lt_id) as rmaxid from lt_t_content";
$res = MySQL_query($query, $dbh);
$row = mysql_fetch_array($res);
$f_chat_hh = $row["rmaxid"];
if (empty($f_chat_hh)) { $f_chat_hh = 0; }
if ($f_chat_hh > 12 ) {
$chat_hh=$f_chat_hh - 12;
} else
$chat_hh=$f_chat_hh;
$un_len=strlen($name);
$uname=$name;
//增加在线人员信息
$query = "select count(*) as rcount from lt_t_online where lt_username = '".$name."'";
$res = mysql_query($query, $dbh);
$row = mysql_fetch_array($res);
$lcount = $row["rcount"];
if ($lcount == 0) {
$query = "insert into lt_t_online(lt_username,lt_lasttime) values(";
$query .= "'".$name."',now())";
$res = mysql_query($query, $dbh);
}
$query = "update lt_t_online set lt_lasttime = now(),lt_state = '0' ";
$query .= " where lt_username = '".$name."'";
$res = mysql_query($query, $dbh);
?>
<html>
<head>
<title>PHP无刷新感聊天室</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script Language=javaScript>
function wu(){
var un="<?echo $name;?>";
this.f2.document.fyq.username.value=un;
this.f2.document.fyq.username.size=<?echo $un_len;?>;
}
</script>
</head>
<frameset cols='*,140' border=1 frameborder=1 framespacing=>
<frameset rows="0,*,70,0" border="1" framespacing="0" frameborder="yes">
<frame src="about:blank" name="tforlt4">
<frame src="about:blank" name="f1" marginheight="3" marginwidth="5">
<frame src="ltsayno.php" name="f2">
<frame src="about:blank" name="bforlt3">
</frameset>
<frameset rows='*,150' border=1 frameborder=1 framespacing=0>
<frame src='ltonline.php' name='f3' marginwidth=0 scrolling='auto'>
<frame src="about:blank" name='f4' marginwidth=0>
</frameset>
</frameset>
<noframes>
<body bgcolor="#FFFFFF">
</body></noframes>
</html>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
该程序为整个系统的入口,含有两个全局参数:chat_hh,uname分别记录当前最大的发言序号和发言者名称
<?
session_start();
session_register("chat_hh");
session_register("uname");
//取数据库最大编号
include("g_fun.php");
f_connectdb();
$query = "select max(lt_id) as rmaxid from lt_t_content";
$res = MySQL_query($query, $dbh);
$row = mysql_fetch_array($res);
$f_chat_hh = $row["rmaxid"];
if (empty($f_chat_hh)) { $f_chat_hh = 0; }
if ($f_chat_hh > 12 ) {
$chat_hh=$f_chat_hh - 12;
} else
$chat_hh=$f_chat_hh;
$un_len=strlen($name);
$uname=$name;
//增加在线人员信息
$query = "select count(*) as rcount from lt_t_online where lt_username = '".$name."'";
$res = mysql_query($query, $dbh);
$row = mysql_fetch_array($res);
$lcount = $row["rcount"];
if ($lcount == 0) {
$query = "insert into lt_t_online(lt_username,lt_lasttime) values(";
$query .= "'".$name."',now())";
$res = mysql_query($query, $dbh);
}
$query = "update lt_t_online set lt_lasttime = now(),lt_state = '0' ";
$query .= " where lt_username = '".$name."'";
$res = mysql_query($query, $dbh);
?>
<html>
<head>
<title>PHP无刷新感聊天室</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script Language=javaScript>
function wu(){
var un="<?echo $name;?>";
this.f2.document.fyq.username.value=un;
this.f2.document.fyq.username.size=<?echo $un_len;?>;
}
</script>
</head>
<frameset cols='*,140' border=1 frameborder=1 framespacing=>
<frameset rows="0,*,70,0" border="1" framespacing="0" frameborder="yes">
<frame src="about:blank" name="tforlt4">
<frame src="about:blank" name="f1" marginheight="3" marginwidth="5">
<frame src="ltsayno.php" name="f2">
<frame src="about:blank" name="bforlt3">
</frameset>
<frameset rows='*,150' border=1 frameborder=1 framespacing=0>
<frame src='ltonline.php' name='f3' marginwidth=0 scrolling='auto'>
<frame src="about:blank" name='f4' marginwidth=0>
</frameset>
</frameset>
<noframes>
<body bgcolor="#FFFFFF">
</body></noframes>
</html>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
- ››采用oracle中exp远程备份oracle
- ››采用 Rational Functional Tester 8.0 实现 Eclip...
- ››采用Symbian^3系统 诺基亚N8-00获证实
- ››聊天工具Miranda IM v0.8.19 发布了
- ››采用“独占”的方式给数据库设置密码
- ››聊天升级 有备MSN管家1.1版发布了
- ››采用DIV+CSS制作网站的优势
- ››采用Inventor的机械压机参数化设计及运动仿真
- ››采用碎片整理技术避免虚拟服务器性能下降
- ››采用C#反射机制和动态参数实现可插件业务平台
- ››聊天工具:Pidgin 2.5.1 发布
- ››聊天感受奥运氛围 飞信奥运特别版发布
更多精彩
赞助商链接