【php开源代码栏目提醒】:网学会员--在 php开源代码编辑为广大网友搜集整理了:control.php绩等信息,祝愿广大网友取得需要的信息,参考学习。
<?php
$forbiddenname = "./tmp/forbidden.txt";
$fl = fopen($forbiddenname,"r+");
$userlist = @explode("\n",fread($fl,filesize($forbiddenname)));
@fclose($fl);
if (in_array(iconv("UTF-8","gb2312",$whoChat),$userlist)){
die("你已经被禁止发言!");
}
$listname = "./tmp/list.txt"; //"http://".$_SERVER ['HTTP_HOST']."/chat/tmp/list.txt";
$fl = fopen($listname,"r+");
$userlist = explode("\n",fread($fl,filesize($listname)));
//$userlist = @file($listname);
fclose($fl);
if (!in_array($whoChat,$userlist)){
$_tosay="[
系统公告] ".iconv("UTF-8","gb2312",$whoChat)." 来到了聊天室,大家欢迎!\n".$_tosay;
}
array_push($userlist,iconv("UTF-8","gb2312",$whoChat));
$newlist = array_unique($userlist);
//$fp = file_get_contents($listname);
//file_put_contents($listname,$newlist);
$fp = fopen($listname,"w");
foreach($newlist as $l)
{
@fwrite($fp,chop($l)."\n");
}
@fclose($fp);
$filename = "./tmp/chat.txt";
$fp = @fopen($filename,"a+");
@fputs($fp,$_tosay);
@fclose($fp);
$lines = @file($filename);
$showmsg = "";
foreach($lines as $l)
{
if (strlen(chop($l))>=1)
$showmsg.=' '.chop($l)."<br>";
}
echo $showmsg;
?>