• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

采用行写方式的聊天程序(之四)_PHP

php 搞代码 4年前 (2022-01-25) 17次浏览 已收录 0个评论

(接前面部分)

<body leftmargin=”0″ topmargin=”0″>

姓名:

说:

onm ouseOut=”window.status=”; return true” onClick=”document.forms[0].towhoway.checked=!(document.forms[0].towhoway.checked); document.forms[0].saystemp.focus();” title=”悄悄话儿悄悄说”>私聊

大家

动作:
—-
招呼

parent.f1.scrollit();
document.fyq.saystemp.focus();”>滚屏

<script>
parent.wu();
write();
document.fyq.saystemp.focus();
</script>

lt3.php
处理发言信息

<?
session_start();
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);
$maxid = $row[“rmaxid”];
if (empty($maxid)) { $maxid = 0; }
$maxid = $maxid 1;
//增加聊天信息
$query = “insert into lt_t_content(lt_id,lt_speaker,lt_speaked,lt_secrecy,lt_content,lt_time,lt_face)”;
$query .= ” values(“.$maxid.”,'”.$username.”‘,'”.$towho.”‘,’1’,'”.$oldsays.”‘,now(),’1’)”;
$res = mysql_query($query, $dbh);

//修改最后聊天时间,判断用户是否存在,防止超时被删除
$query = “select count(*) as rcount from lt_t_online where lt_username = ‘”.$username.”‘”;
$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 .= “‘”.$username.”‘,now())”;
$res = mysql_query($query, $dbh);
}
$query = “update lt_t_online set lt_lasttime = now(),lt_state = ‘0’ where lt_username = ‘”.$username.”‘”;
$res = mysql_query($query, $dbh);

//显示聊天记录
$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 desc”;
$res = mysql_query($query, $dbh);
$chat_hh = $maxid;
$tempi = $maxid

4本文¥来源gao!%daima.com搞$代*!码$网9

搞代gaodaima码

;
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;
}

?>

【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:采用行写方式的聊天程序(之四)_PHP

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址