【php开源代码栏目提醒】:网学会员php开源代码为您提供readmessage.php参考,解决您在readmessage.php学习中工作中的难题,参考学习。
<?php
session_start();
include "include/query.php";
include "include/functions.php";
//
//验证用户身份。
//
if(!verifyMember(session_id(),$_SESSION["username"]))
{
echo "parent.location.href=\"notice.php?id=".not_login."\"";
exit;
}
//更新在线时间
$tm = time();
$db->query("update `onlinelist` set `activetime` = '{$tm}' where `username` = '{$_SESSION["username"]}'");
//读取消息
$sql = "select * from `messages` where (`to_user` = '".$_SESSION["username"]."' or `private`=0) and `id` > {$_GET["messageid"]} and `from_user` != '{$_SESSION["username"]}' and `roomid` = '{$_SESSION["roomid"]}' order by `id` asc";
$result = $db->query($sql);
$totalRows = $db->numrows($result);
$readedRows = 0;
while($rows = $db->fetchArray($result))
{
echo 'writeMessage("'.nl2br(addslashes($rows["content"])).'","'.$rows["from_user"].'","'.$rows["to_user"].'","'.$rows["time"].'","'.$rows["title"].'","'.$rows["saycolor"].'","'.$rows["namecolor"].'","'.$rows["private"].'","'.$rows["type"].'","'.$rows["event"].'","'.$rows["face"].'");';
$readedRows ++;
if($readedRows==$totalRows)
echo "messageid=".$rows["id"].";";
}
clean_member();
$db->close();
?>
上一篇:
readme.php
下一篇:
驾校管理系统,涉及到VC++的通用模块和数据库设计,操作简练。