采用行寫方式的聊天程序(之五)

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)) {
?>

<?
$tempi=$row[lt_id];
}
if ($tempi > $chat_hh) {
$chat_hh = $tempi;
}
?>

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 " 在線人員信息
";
$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"].
;
}
?>

【本文版權歸作者與奧索網共同擁有,如需轉載,請註明作者及出處】

You May Also Like