来源:自学PHP网 时间:2014-12-25 09:56 作者: 阅读:次
[导读] 采用行写方式的聊天程序(之五),lt4.php处理定时刷新问题lt;?session_start;includequot;g_fun.phpquot;;f_connectdb;$tmpi=0;$querynbsp;nbsp;=quot;selectlt_id,lt_speaker,lt_face,lt_speaked,lt_time,lt_contentfromlt_t_contentq...
lt4.php
处理定时刷新问题 <? session_start(); include("g_fun.php"); f_connectdb(); $tmpi = 0; $query = "select lt_id,lt_speaker,lt_face,lt_speaked,lt_time,lt_content from lt_t_content"; $query .= " where lt_id > ".$chat_hh. " order by lt_time "; $res = MySQL_query($query, $dbh); while ($row = mysql_fetch_array($res)) { ?> <script Language=javaScript1.1> var zt="<? echo '0'; ?>"; var un="<?echo $row['lt_speaker'];?>"; var tw="<?echo $row['lt_speaked'];?>"; var sa="<?echo $row['lt_content'];?>"; parent.f2.nw(zt,un,tw,sa); //向显示处写入最新的数据. </script> <? $tempi=$row['lt_id']; } if ($tempi > $chat_hh) { $chat_hh = $tempi; } ?> <script Language=Javascript> setTimeout('this.location.reload()',5000);</script> ltonline.php 处理在线用户信息 <? include("g_fun.php"); f_connectdb(); //删除长时间没有发言的用户信息 $query = "update lt_t_online set lt_state = '1' where (now() - lt_lasttime) > 500"; $res = mysql_query($query, $dbh); PRint " 在线人员信息<br>"; $query = "select lt_username from lt_t_online where lt_state = '0'"; $res = mysql_query($query, $dbh); while ($row = mysql_fetch_array($res)) { print $row["lt_username"].'<br>'; } ?> <script Language=JavaScript> setTimeout('this.location.reload()',5000);</script> 【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】 |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com