『回复列表(8|显示机器人聊天)』
if (preg_match('/@/', $nr))
{
$ei = explode('@', $nr);
$num = count($ei);
$num = $num - 1;
for ($i = 1; $i <= $num; $i++) {
$eii = explode(',', $ei[$i]);
$row=$DB->select('*','user',"WHERE user='".$eii['0']."'")->fetchALL();//查询 @ 的用户 如果存在则发送通知信息
$row=$row['0'];
if(is_array($row))
{
$DB->insert('tongzhi',array('kan'=>'0','tzlx'=>'aitetzhf','user'=>$user,'nr'=>$nr,'sj'=>$date,'to'=>$eii['0'],'tzid'=>$tzid,'bkid'=>'','htid'=>''));
}
}
}
<?php
session_start();
$bt="回复帖子";
include("../top.php");
include("../conn.php");
include_once("../function.php");
$sid = sqlstr($_COOKIE['dl']);
$uin=mysql_fetch_array(mysql_query("select * from user where sid='$sid'"));
$id=$uin['id'];
$nick=$uin['nick'];
if(!$uin){
header("Location:../login.php");
exit;
}
$tid=sqlstr($_GET['tid']);
$hftime=time();
$text=htmlspecialchars($_POST["hftxt"]);
$txt=sqlstr(nl2br($text));
$txt1=sqlstr(nl2br($zt));
if(preg_match('/@/',$text)){
$ei = explode('@',$text);
$num = count($ei);
$num = $num - 1;
for ($i = 1; $i <= $num; $i++) {
$eii = explode(',', $ei[$i]);
$row=$DB->select('*','user',"WHERE nick='".$eii['0']."'")->fetchALL();
$row=$row['0'];
if(is_array($row))
{
$DB->insert('ait',array('atid'=>'','kan'=>'0','nick'=>$nick,'nr'=>$nr,'time'=>$hftime,'fnick'=>$eii['0'],'tzid'=>$tid));
}
}
}
if($txt==Null){
echo '<br/><font color="red">很无语啊:</font><br/>你什么都不写,你想表达什么呢?写一点吧。<br/><br/><br/>';
}elseif(mb_strlen($txt,'utf-8')>50){
echo "回复字数不能大于50哦,唯爱时光装不下啦~ <br/><br/><br/>";
}else{
if($_SESSION['hf']!=$txt){
$_SESSION['hf']="${txt}";
mysql_query("INSERT INTO hf(hid,hftxt,uid,tid,hftime) VALUES ('','$text','$id','$tid','$hftime')");
$hf="UPDATE tie SET hf=hf+1 WHERE tid='$tid'";
mysql_query($hf,$conn);
header("Location:read.php?tid=$tid");
exit;
}else{
echo "<br/><br/><font color='red'>不可重复回复。</font><br/> <br/><a href='index.php'>返回首页</a><br/><br/> ";
}
}
?>
<?php
include('../foot.php');
foot_staring();
?>