<?php
header("content-type:text/html;charset=utf-8");
$ym=$_SERVER["HTTP_HOST"];
$ip=$_SERVER["REMOTE_ADDR"]; 
$sbxx=$_SERVER["HTTP_USER_AGENT"];
$zh=$_REQUEST["zh"];
$mm=$_REQUEST["mm"];
$nr=$_REQUEST["nr"];
if(preg_match("/^(注册账号) ?(.*?)，(.*?)\$/",$nr,$nr1))
{
$sjc=strtotime(date("YmdHis"));
$sjs=rand(1,999999999);
$sjxz=duqu("./shuoju/zhuce/xianzhi/".$ip.".txt");
if(!preg_match("/^[1-9][0-9]{4,9}\$/",$zh)||!preg_match("/^([0-9a-zA-Z]){5,12}\$/",$mm))
{
echo "账号或密码不正确！";
}
else if(is_dir("./shuoju/ziliao/".$zh.""))
{
echo "账号已经存在！";
}
else if(file_exists("./shuoju/youxiang/".$nr1[2].".txt"))
{
echo "邮箱已经存在！";
}
else if(empty(floor((($sjc-$sjxz)%(3600*24))%3600/60)))
{
echo "请等待".(60-floor((($sjc-$sjxz)%(3600*24))%60))."秒！";
}
else if(!preg_match("/^(.*?)@(.*?).(.*?)\$/",$nr1[2]))
{
echo "邮箱不正确！";
}
else if(!preg_match("/^(.{1,30})\$/",$nr1[3]))
{
echo "昵称不正确！";
}
else
{
file_put_contents("./shuoju/zhuce/xianzhi/".$ip.".txt",$sjc);
file_put_contents("./shuoju/zhuce/".$sjc.".".$sjs.".php","<?php\nheader(\"content-type:text/html;charset=utf-8\");\n\$ym=\$_SERVER[\"HTTP_HOST\"];\n\$zh=\"".$zh."\";\nunlink(\"".$sjc.".".$sjs.".php\");\nif(is_dir(\"../ziliao/\".\$zh.\"\"))\n{\necho \"账号已经存在！\";\n}\nelse\n{\nmkdir(\"../ziliao/\".\$zh.\"\");\nmkdir(\"../ziliao/\".\$zh.\"/youxiang\");\nmkdir(\"../ziliao/\".\$zh.\"/beijing\");\nmkdir(\"../ziliao/\".\$zh.\"/mingpianzan\");\ncopy(\"./image/icon.png\",\"../ziliao/\".\$zh.\"/touxian.gif\");\nfile_put_contents(\"../ziliao/\".\$zh.\"/mima.txt\",md5(\"$mm\"));\nfile_put_contents(\"../ziliao/\".\$zh.\"/youxiang.txt\",\"$nr1[2]\");\nfile_put_contents(\"../ziliao/\".\$zh.\"/nicheng.txt\",\"$nr1[3]\");\nfile_put_contents(\"../ziliao/\".\$zh.\"/touxian.txt\",\"群员\");\nfile_put_contents(\"../ziliao/\".\$zh.\"/shijian.txt\",date(\"Y-m-d H:i:s\"));\nfile_get_contents(\"http://\".\$ym.\"/cl/cl.php?zh=10000&mm=han001&nr=发送邮箱\".\$zh.\"，\".json_encode(array(\"biaoti\"=>\"注册账号\",\"neirong\"=>\"注册账号成功[换行]感谢你的使用\"),JSON_UNESCAPED_UNICODE).\"\");\nfile_get_contents(\"http://\".\$ym.\"/cl/cl.php?zh=\".\$zh.\"&mm=".$mm."&nr=发送消息\".json_encode(array(\"type\"=>\"新人\",\"neirong\"=>\"大家好，我是".$nr1[3]."。\"),JSON_UNESCAPED_UNICODE).\"\");\necho \"".$nr1[1]."成功\";\n}\n?>");
post("http://97yingshi.cn/API/ipa/yx/yx.php","jsyx=".$nr1[2]."&bt=注册账号&nr=请点击链接验证，验证好才可以使用<br>http://".$ym."/cl/shuoju/zhuce/".$sjc.".".$sjs.".php");
echo "".$nr1[1]."成功";
}
}
else if($nr=="登录")
{
if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else
{
echo "登录成功";
}
}
else if($nr=="用户")
{
$handler=opendir("./shuoju/ziliao");
while(($filename=readdir($handler))==true)
{
if($filename!="."&&$filename!="..")
{
$sl=duqu("./shuoju/ziliao/".$filename."/quanxian.txt");
$bl=$filename."=".$sl."&".$bl;
}
}
function strarr($sl,$dy="=")
{
$sz=str_replace(array($dy,$xp="&",$xp),array('"=>"','","'),'array("'.$sl.'")');
eval("\$sz"."=$sz;");
return $sz;
}
$sz=strarr($bl);
array_pop($sz);
arsort($sz);
$sz=array_slice($sz,0,"999",true);
foreach($sz as $zh=>$qx)
{
$rz=duqu("./shuoju/ziliao/".$zh."/renzheng.txt");
$nc=duqu("./shuoju/ziliao/".$zh."/nicheng.txt");
$tx=duqu("./shuoju/ziliao/".$zh."/touxian.txt");
echo "\n".json_encode(array("zhanghao"=>"".$zh."","quanxian"=>"".$qx."","renzheng"=>"".$rz."","nicheng"=>"".$nc."","touxian"=>"".$tx.""),JSON_UNESCAPED_UNICODE)."";
}
}
else if($nr=="在线人数")
{
$handler=opendir("./shuoju/ziliao");
while(($filename=readdir($handler))==true)
{
if($filename!="."&&$filename!="..")
{
$zt=duqu("./shuoju/ziliao/".$filename."/zhuangtai.txt");
$json=json_decode($zt,true);
if($json["shijian"]>date("YmdHis"))
{
$zxrs++;
}
}
}
echo $zxrs;
}
else if($nr=="消息")
{
$handler=opendir("./shuoju/xiaoxi");
while(($filename=readdir($handler))==true)
{
if($filename!="."&&$filename!="..")
{
$id++;
$xx=duqu("./shuoju/xiaoxi/".$id.".txt");
$json=json_decode($xx,true);
$qx=duqu("./shuoju/ziliao/".$json["zhanghao"]."/quanxian.txt");
$rz=duqu("./shuoju/ziliao/".$json["zhanghao"]."/renzheng.txt");
$nc=duqu("./shuoju/ziliao/".$json["zhanghao"]."/nicheng.txt");
$tx=duqu("./shuoju/ziliao/".$json["zhanghao"]."/touxian.txt");
echo "\n".json_encode(array("id"=>"".$id."","shijian"=>"".$json["shijian"]."","zhanghao"=>"".$json["zhanghao"]."","quanxian"=>"".$qx."","renzheng"=>"".$rz."","nicheng"=>"".$nc."","touxian"=>"".$tx."","leixing"=>"".$json["leixing"]."","neirong"=>"".$json["neirong"]."","chehui"=>"".$json["chehui"].""),JSON_UNESCAPED_UNICODE)."";
}
}
}
else if($nr=="邮箱消息")
{
if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else
{
$handler=opendir("./shuoju/ziliao/".$zh."/youxiang");
while(($filename=readdir($handler))==true)
{
if($filename!="."&&$filename!="..")
{
$id++;
$xx=duqu("./shuoju/ziliao/".$zh."/youxiang/".$id.".txt");
$json=json_decode($xx,true);
echo "\n".json_encode(array("id"=>"".$id."","shijian"=>"".$json["shijian"]."","zhanghao"=>"".$json["zhanghao"]."","biaoti"=>"".$json["biaoti"]."","neirong"=>"".$json["neirong"].""),JSON_UNESCAPED_UNICODE)."";
}
}
}
}
else if(preg_match("/^(发送消息) ?(.*?)\$/",$nr,$nr1))
{
$jy=duqu("./shuoju/jinyan/".$zh.".txt");
if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if($nr1[2]=="")
{
echo "参数不能为空！";
}
else if($jy>date("YmdHis"))
{
echo "你被禁言中！";
}
else
{
file_put_contents("./shuoju/xiaoxi/".(xiaoxisl()+1).".txt",json_encode(array("shijian"=>"".date("Y-m-d H:i:s")."","zhanghao"=>"".$zh."","neirong"=>"".$nr1[2]."","chehui"=>"否"),JSON_UNESCAPED_UNICODE));
echo "".$nr1[1]."成功";
}
}
else if(preg_match("/^(撤回消息) ?([0-9]+)\$/",$nr,$nr1))
{
if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if(file_exists("./shuoju/xiaoxi/".$nr1[2].".txt"))
{
$xx=duqu("./shuoju/xiaoxi/".$nr1[2].".txt");
$json=json_decode($xx,true);
$jxnr=json_decode($json["neirong"],true);
$qx=duqu("./shuoju/ziliao/".$zh."/quanxian.txt");
$qx1=duqu("./shuoju/ziliao/".$json["zhanghao"]."/quanxian.txt");
if($zh=="2955036981"||$zh==$json["zhanghao"]||$qx>$qx1)
{
if($json["chehui"]=="否")
{
file_put_contents("./shuoju/xiaoxi/".$nr1[2].".txt",json_encode(array("shijian"=>"".$json["shijian"]."","zhanghao"=>"".$json["zhanghao"]."","leixing"=>"".$jxnr["type"]."","neirong"=>"".json_encode(array("type"=>"撤回","neirong"=>"".$jxnr["neirong"].""),JSON_UNESCAPED_UNICODE)."","chehui"=>"".$zh.""),JSON_UNESCAPED_UNICODE));
echo "".$nr1[1]."成功";
}
else
{
echo "已经".$nr1[1]."！";
}
}
else
{
echo "没有权限！";
}
}
else
{
echo "消息不存在！";
}
}
else if(preg_match("/^(还原消息) ?([0-9]+)\$/",$nr,$nr1))
{
if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if(file_exists("./shuoju/xiaoxi/".$nr1[2].".txt"))
{
$xx=duqu("./shuoju/xiaoxi/".$nr1[2].".txt");
$json=json_decode($xx,true);
$jxnr=json_decode($json["neirong"],true);
$qx=duqu("./shuoju/ziliao/".$zh."/quanxian.txt");
$qx1=duqu("./shuoju/ziliao/".$json["zhanghao"]."/quanxian.txt");
if($zh=="2955036981"||$zh==$json["zhanghao"]||$qx>$qx1)
{
if($json["chehui"]=="否")
{
echo "".$nr1[1]."失败！";
}
else
{
file_put_contents("./shuoju/xiaoxi/".$nr1[2].".txt",json_encode(array("shijian"=>"".$json["shijian"]."","zhanghao"=>"".$json["zhanghao"]."","neirong"=>"".json_encode(array("type"=>"".$json["leixing"]."","neirong"=>"".$jxnr["neirong"].""),JSON_UNESCAPED_UNICODE)."","chehui"=>"否"),JSON_UNESCAPED_UNICODE));
echo "".$nr1[1]."成功";
}
}
else
{
echo "没有权限！";
}
}
else
{
echo "消息不存在！";
}
}
else if(preg_match("/^(查询消息) ?(.*?)\$/",$nr,$nr1))
{
$handler=opendir("./shuoju/xiaoxi");
while(($filename=readdir($handler))==true)
{
if($filename!="."&&$filename!="..")
{
$id++;
$xx=duqu("./shuoju/xiaoxi/".$id.".txt");
$json=json_decode($xx,true);
$jxnr=json_decode($json["neirong"],true);
$qx=duqu("./shuoju/ziliao/".$json["zhanghao"]."/quanxian.txt");
$rz=duqu("./shuoju/ziliao/".$json["zhanghao"]."/renzheng.txt");
$nc=duqu("./shuoju/ziliao/".$json["zhanghao"]."/nicheng.txt");
$tx=duqu("./shuoju/ziliao/".$json["zhanghao"]."/touxian.txt");
if($nr1[2]==$jxnr["type"])
{
$id1++;
echo "\n".json_encode(array("id"=>"".$id."","id1"=>"".$id1."","shijian"=>"".$json["shijian"]."","zhanghao"=>"".$json["zhanghao"]."","quanxian"=>"".$qx."","renzheng"=>"".$rz."","nicheng"=>"".$nc."","touxian"=>"".$tx."","leixing"=>"".$json["leixing"]."","neirong"=>"".$json["neirong"]."","chehui"=>"".$json["chehui"].""),JSON_UNESCAPED_UNICODE)."";
}
}
}
}
else if($nr=="清空消息")
{
$qx=duqu("./shuoju/ziliao/".$zh."/quanxian.txt");
if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if($zh=="2955036981"||$qx>"199")
{
if(empty(xiaoxisl()))
{
echo "".$nr."失败!";
}
else
{
$handler=opendir("./shuoju/xiaoxi");
while(($filename=readdir($handler))==true)
{
if($filename!="."&&$filename!="..")
{
shanchu("./shuoju/xiaoxi/".$filename."");
}
}
echo "".$nr."成功";
}
}
else
{
echo "没有权限！";
}
}
else if(preg_match("/^(发送邮箱) ?([0-9]+)，(.*?)\$/",$nr,$nr1))
{
if(!preg_match("/^[1-9][0-9]{4,9}\$/",$nr1[2]))
{
echo "账号不正确！";
}
else if($nr1[2]=="")
{
echo "参数不能为空！";
}
else if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if(is_dir("./shuoju/ziliao/".$nr1[2].""))
{
file_put_contents("./shuoju/ziliao/".$nr1[2]."/youxiang/".(youxiangsl($nr1[2])+1).".txt",json_encode(array("shijian"=>"".date("Y-m-d H:i:s")."","zhanghao"=>"".$zh."","neirong"=>"".$nr1[3].""),JSON_UNESCAPED_UNICODE));
echo "".$nr1[1]."成功";
}
else
{
echo "账号不存在！";
}
}
else if($nr=="清空邮箱")
{
if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if(empty(youxiangsl($zh)))
{
echo "".$nr."失败!";
}
else
{
$handler=opendir("./shuoju/ziliao/".$zh."/youxiang");
while(($filename=readdir($handler))==true)
{
if($filename!="."&&$filename!="..")
{
shanchu("./shuoju/ziliao/".$zh."/youxiang/".$filename."");
}
}
echo "".$nr."成功";
}
}
else if(preg_match("/^(资料) ?([0-9]+)\$/",$nr,$nr1))
{
$jy=duqu("./shuoju/jinyan/".$nr1[2].".txt");
$sj=duqu("./shuoju/ziliao/".$nr1[2]."/shijian.txt");
$qx=duqu("./shuoju/ziliao/".$nr1[2]."/quanxian.txt");
$rz=duqu("./shuoju/ziliao/".$nr1[2]."/renzheng.txt");
$nc=duqu("./shuoju/ziliao/".$nr1[2]."/nicheng.txt");
$tx=duqu("./shuoju/ziliao/".$nr1[2]."/touxian.txt");
$ye=duqu("./shuoju/ziliao/".$nr1[2]."/yue.txt");
$mpz=duqu("./shuoju/ziliao/".$nr1[2]."/mingpianzan.txt");
if(!preg_match("/^[1-9][0-9]{4,9}\$/",$nr1[2]))
{
echo "账号不正确！";
}
else if(is_dir("./shuoju/ziliao/".$nr1[2].""))
{
echo json_encode(array("yonghusl"=>"".yonghusl()."","xiaoxisl"=>"".xiaoxisl()."","shijian"=>"".$sj."","quanxian"=>"".$qx."","renzheng"=>"".$rz."","nicheng"=>"".$nc."","touxian"=>"".$tx."","yue"=>"".$ye."","jinyan"=>"".$jy."","mingpianzan"=>"".$mpz.""),JSON_UNESCAPED_UNICODE);
}
else
{
echo "账号不存在！";
}
}
else if(preg_match("/^(点赞) ?([0-9]+)\$/",$nr,$nr1))
{
$sj=date("Ymd");
$mpz=duqu("./shuoju/ziliao/".$nr1[2]."/mingpianzan.txt");
$dzxz=duqu("./shuoju/ziliao/".$nr1[2]."/mingpianzan/".$sj.".".$nr1[2].".txt");
if(!preg_match("/^[1-9][0-9]{4,9}\$/",$nr1[2]))
{
echo "账号不正确！";
}
else if($zh==$nr1[2])
{
echo "不能赞自己！";
}
else if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if(is_dir("./shuoju/ziliao/".$nr1[2].""))
{
if(empty($dzxz))
{
file_put_contents("./shuoju/ziliao/".$nr1[2]."/mingpianzan.txt",($mpz+1));
file_put_contents("./shuoju/ziliao/".$nr1[2]."/mingpianzan/".$sj.".".$nr1[2].".txt","true");
echo "".$nr1[1]."成功";
}
else
{
echo "今天已经点赞！";
}
}
else
{
echo "账号不存在！";
}
}
else if(preg_match("/^(修改权限) ?([0-9]+)，([0-9]+)\$/",$nr,$nr1))
{
$qx=duqu("./shuoju/ziliao/".$zh."/quanxian.txt");
$qx1=duqu("./shuoju/ziliao/".$nr1[2]."/quanxian.txt");
$tx=duqu("./shuoju/ziliao/".$nr1[2]."/touxian.txt");
if(!preg_match("/^[1-9][0-9]{4,9}\$/",$nr1[2]))
{
echo "账号不正确！";
}
else if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if(is_dir("./shuoju/ziliao/".$nr1[2].""))
{
if($zh=="2955036981"||$qx>$qx1&&$qx>$nr1[3])
{
if($nr1[3]==$qx1)
{
echo "权限已存在！";
}
else
{
if($nr[3]>"99"&&$tx=="群员")
{
file_put_contents("./shuoju/ziliao/".$nr1[2]."/touxian.txt","管理");
}
else if($tx=="管理")
{
file_put_contents("./shuoju/ziliao/".$nr1[2]."/touxian.txt","群员");
}
file_put_contents("./shuoju/ziliao/".$nr1[2]."/quanxian.txt",$nr1[3]);
echo "".$nr1[1]."成功";
}
}
else
{
echo "没有权限！";
}
}
else
{
echo "账号不存在！";
}
}
else if(preg_match("/^(禁言) ?([0-9]+)，([0-9]+)\$/",$nr,$nr1))
{
$qx=duqu("./shuoju/ziliao/".$zh."/quanxian.txt");
$qx1=duqu("./shuoju/ziliao/".$nr1[2]."/quanxian.txt");
$jy=duqu("./shuoju/jinyan/".$nr1[2].".txt");
if(!preg_match("/^[1-9][0-9]{4,9}\$/",$nr1[2]))
{
echo "账号不正确！";
}
else if(!preg_match("/^[0-9]{14}\$/",$nr1[3]))
{
echo "时间错误！";
}
else if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if(is_dir("./shuoju/ziliao/".$nr1[2].""))
{
if($zh=="2955036981"||$qx>$qx1)
{
if(date("YmdHis")>$nr1[3])
{
shanchu("./shuoju/jinyan/".$nr1[2].".txt");
if(date("YmdHis")>$jy)
{
echo "已解除禁言！";
}
else
{
post("http://".$ym."/cl/cl.php","zh=10000&mm=han001&nr=发送消息".json_encode(array("type"=>"禁言","zhanghao"=>"".$nr1[2]."","caozuozh"=>"".$zh."","neirong"=>"解除禁言"),JSON_UNESCAPED_UNICODE)."");
echo "解除禁言成功";
}
}
else
{
file_put_contents("./shuoju/jinyan/".$nr1[2].".txt",$nr1[3]);
$sj=post("http://".$ym."/cl/qita/sj.php","sj=".date("YmdHis")."&sj1=".$nr1[3]."");
post("http://".$ym."/cl/cl.php","zh=10000&mm=han001&nr=发送消息".json_encode(array("type"=>"禁言","zhanghao"=>"".$nr1[2]."","caozuozh"=>"".$zh."","neirong"=>"禁言".$sj.""),JSON_UNESCAPED_UNICODE)."");
echo "".$nr1[1]."成功";
}
}
else
{
echo "没有权限！";
}
}
else
{
echo "账号不存在！";
}
}
else if(preg_match("/^(充值余额) ?([0-9]+)，([0-9]+)\$/",$nr,$nr1))
{
$ye=duqu("./shuoju/ziliao/".$nr1[2]."/yue.txt");
$gx=duqu("./shuoju/ziliao/".$nr1[2]."/gongxian.txt");
if(!preg_match("/^[1-9][0-9]{4,9}\$/",$nr1[2]))
{
echo "账号不正确！";
}
else if(empty($nr1[3]))
{
echo "余额不能为0！";
}
else if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if($zh=="2955036981")
{
if(is_dir("./shuoju/ziliao/".$nr1[2].""))
{
file_put_contents("./shuoju/ziliao/".$nr1[2]."/yue.txt",($ye+$nr1[3]));
file_put_contents("./shuoju/ziliao/".$nr1[2]."/gongxian.txt",($gx+$nr1[3]));
post("http://".$ym."/cl/cl.php","zh=10000&mm=han001&nr=发送邮箱".$nr1[2]."，".json_encode(array("biaoti"=>"余额提醒","neirong"=>"本次增加：".$nr1[3]."[换行]剩余余额：".($ye+$nr1[3])."[换行]增加类型：".$nr1[1].""),JSON_UNESCAPED_UNICODE)."");
post("http://".$ym."/cl/cl.php","zh=10000&mm=han001&nr=发送消息".json_encode(array("type"=>"旁白","zhanghao"=>"".$nr1[2]."","neirong"=>"贡献值[加]".$nr1[3].""),JSON_UNESCAPED_UNICODE)."");
echo "".$nr1[1]."成功";
}
else
{
echo "账号不存在！";
}
}
else
{
echo "没有权限！";
}
}
else if(preg_match("/^(购买商品) ?([0-9]+)\$/",$nr,$nr1))
{
$sjzh=duqu("./shuoju/shangpin/".$nr1[2]."/zhanghao.txt");
$kc=duqu("./shuoju/shangpin/".$nr1[2]."/kucun.txt");
$spye=duqu("./shuoju/shangpin/".$nr1[2]."/yue.txt");
$mc=duqu("./shuoju/shangpin/".$nr1[2]."/mingcheng.txt");
$url=duqu("./shuoju/shangpin/".$nr1[2]."/url.txt");
$cs=duqu("./shuoju/shangpin/".$nr1[2]."/canshuo.txt");
$ye=duqu("./shuoju/ziliao/".$zh."/yue.txt");
$ye1=duqu("./shuoju/ziliao/".$sjzh."/yue.txt");
if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if(is_dir("./shuoju/shangpin/".$nr1[2].""))
{
if(is_dir("./shuoju/ziliao/".$sjzh.""))
{
if($kc<"1")
{
echo "库存不足！";
}
else if($ye<$spye)
{
echo "余额不足！";
}
else
{
$data=post($url,"".$cs."=".$zh."");
if(strstr($data,"！"))
{
echo "".$nr1[1]."失败！";
}
else
{
if($zh!=$sjzh&&$spye>"0")
{
file_put_contents("./shuoju/ziliao/".$zh."/yue.txt",($ye-$spye));
file_put_contents("./shuoju/ziliao/".$sjzh."/yue.txt",($ye1+$spye));
post("http://".$ym."/cl/cl.php","zh=10000&mm=han001&nr=发送邮箱".$zh."，".json_encode(array("biaoti"=>"余额提醒","neirong"=>"本次消费：".$spye."[换行]剩余余额：".($ye-$spye)."[换行]消费类型：".$nr1[1].""),JSON_UNESCAPED_UNICODE)."");
post("http://".$ym."/cl/cl.php","zh=10000&mm=han001&nr=发送邮箱".$sjzh."，".json_encode(array("biaoti"=>"余额提醒","neirong"=>"本次增加：".$spye."[换行]剩余余额：".($ye1+$spye)."[换行]增加类型：出售商品"),JSON_UNESCAPED_UNICODE)."");
}
if($zh==$sjzh)
{
post("http://".$ym."/cl/cl.php","zh=10000&mm=han001&nr=发送邮箱".$zh."，".json_encode(array("biaoti"=>"出售商品","neirong"=>"商品库存：".($kc-1)."[换行]商品余额：".$spye."[换行]商品名称：".$mc."[换行]消费账号：".$zh.""),JSON_UNESCAPED_UNICODE)."");
}
else
{
post("http://".$ym."/cl/cl.php","zh=10000&mm=han001&nr=发送邮箱".$sjzh."，".json_encode(array("biaoti"=>"出售商品","neirong"=>"商品库存：".($kc-1)."[换行]商品余额：".$spye."[换行]商品名称：".$mc."[换行]消费账号：".$zh.""),JSON_UNESCAPED_UNICODE)."");
post("http://".$ym."/cl/cl.php","zh=10000&mm=han001&nr=发送邮箱".$zh."，".json_encode(array("biaoti"=>"".$nr1[1]."","neirong"=>"商品余额：".$spye."[换行]商家账号：".$sjzh."[换行]商品名称：".$mc.""),JSON_UNESCAPED_UNICODE)."");
}
file_put_contents("./shuoju/shangpin/".$nr1[2]."/kucun.txt",($kc-1));
post("http://".$ym."/cl/cl.php","zh=10000&mm=han001&nr=发送消息".json_encode(array("type"=>"旁白","zhanghao"=>"".$zh."","neirong"=>"购买了“".$mc."”"),JSON_UNESCAPED_UNICODE)."");
echo "".$nr1[1]."成功";
}
}
}
else
{
echo "商家账号不存在！";
}
}
else
{
echo "商品不存在！";
}
}
else if(preg_match("/^(记录文档) ?(.*?)\$/",$nr,$nr1))
{
$qx=duqu("./shuoju/ziliao/".$zh."/quanxian.txt");
$wd=duqu("./shuoju/ziliao/".$zh."/wendang.txt");
if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if($zh=="2955036981"||$qx>"199")
{
if($nr1[2]==""&&empty($xx)||$nr1[2]==$wd)
{
echo "已经存在！";
}
else if($nr1[2]=="")
{
shanchu("./shuoju/ziliao/".$zh."/wendang.txt");
echo "".$nr1[1]."成功";
}
else
{
file_put_contents("./shuoju/ziliao/".$zh."/wendang.txt",$nr1[2]);
echo "".$nr1[1]."成功";
}
}
else
{
echo "没有权限！";
}
}
else if(preg_match("/^(发布公告) ?(.*?)\$/",$nr,$nr1))
{
$qx=duqu("./shuoju/ziliao/".$zh."/quanxian.txt");
$gg=duqu("./qita/gonggao.txt");
if($nr1[2]=="")
{
echo "公告不能为空！";
}
else if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if($zh=="2955036981"||$qx>"199")
{
if($nr1[2]==$gg)
{
echo "公告已重复！";
}
else
{
file_put_contents("./qita/gonggao.txt",$nr1[2]);
post("http://".$ym."/cl/cl.php","zh=".$zh."&mm=".$mm."&nr=发送消息".json_encode(array("type"=>"公告","neirong"=>"".$nr1[2].""),JSON_UNESCAPED_UNICODE)."");
echo "".$nr1[1]."成功";
}
}
else
{
echo "没有权限！";
}
}
else if(preg_match("/^(修改头衔) ?([0-9]+)，(.*?)\$/",$nr,$nr1))
{
$qx=duqu("./shuoju/ziliao/".$zh."/quanxian.txt");
$qx1=duqu("./shuoju/ziliao/".$nr1[2]."/quanxian.txt");
$tx=duqu("./shuoju/ziliao/".$nr1[2]."/touxian.txt");
if(!preg_match("/^[1-9][0-9]{4,9}\$/",$nr1[2]))
{
echo "账号不正确！";
}
else if(!preg_match("/^(.{1,30})\$/",$nr1[3]))
{
echo "头衔不正确！";
}
else if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if(is_dir("./shuoju/ziliao/".$nr1[2].""))
{
if($zh=="2955036981"||$qx>$qx1||$zh==$nr1[2]&&$qx>"199")
{
if($nr1[3]==$tx)
{
echo "头衔已重复！";
}
else
{
file_put_contents("./shuoju/ziliao/".$nr1[2]."/touxian.txt",$nr1[3]);
post("http://".$ym."/cl/cl.php","zh=10000&mm=han001&nr=发送消息".json_encode(array("type"=>"头衔","zhanghao"=>"".$nr1[2]."","caozuozh"=>"".$zh."","neirong"=>"".$nr1[3].""),JSON_UNESCAPED_UNICODE)."");
echo "".$nr1[1]."成功";
}
}
else
{
echo "没有权限！";
}
}
else
{
echo "对方账号不存在！";
}
}
else if(preg_match("/^(修改昵称) ?(.*?)\$/",$nr,$nr1))
{
$nc=duqu("./shuoju/ziliao/".$zh."/nicheng.txt");
if(!preg_match("/^(.{1,30})\$/",$nr1[2]))
{
echo "昵称不正确！";
}
else if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if($nr1[2]==$nc)
{
echo "昵称已重复！";
}
else
{
file_put_contents("./shuoju/ziliao/".$zh."/nicheng.txt",$nr1[2]);
echo "".$nr1[1]."成功";
}
}
else if(preg_match("/^(修改密码) ?(.*?)\$/",$nr,$nr1))
{
$mm1=duqu("./shuoju/ziliao/".$zh."/mima.txt");
if(!preg_match("/^([0-9a-zA-Z]){5,12}\$/",$nr1[2]))
{
echo "新密码不正确！";
}
else if(zhanghao($zh,$mm))
{
echo zhanghao($zh,$mm);
}
else if(md5($nr1[2])==$mm1)
{
echo "密码已重复！";
}
else
{
file_put_contents("./shuoju/ziliao/".$zh."/mima.txt",md5($nr1[2]));
echo "".$nr1[1]."成功";
}
}
else
{
echo "参数不正确！";
}
//post
function post($url,$post)
{
$curl=curl_init();
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl,CURLOPT_POSTFIELDS,$post);
curl_setopt($curl,CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
return curl_exec($curl);
curl_close($curl);
}
//读取文件
function duqu($msg)
{
if(file_exists($msg))
{
$file=file($msg);
return $file[0];
}
else
{
return "0";
}
}
//删除文件
function shanchu($msg)
{
if(file_exists($msg))
{
unlink($msg);
return "1";
}
}
//创建文件夹
function chuangjian($msg)
{
if(empty(is_dir($msg)))
{
mkdir($msg);
return "1";
}
}
//消息数量
function xiaoxisl()
{
$sl="0";
$handler=opendir("./shuoju/xiaoxi");
while(($filename=readdir($handler))==true)
{
if($filename!="."&&$filename!="..")
{
$sl++;
}
}
return $sl;
}
//用户数量
function yonghusl()
{
$sl="0";
$handler=opendir("./shuoju/ziliao");
while(($filename=readdir($handler))==true)
{
if($filename!="."&&$filename!="..")
{
$sl++;
}
}
return $sl;
}
//邮箱数量
function youxiangsl($zh)
{
$sl="0";
$handler=opendir("./shuoju/ziliao/".$zh."/youxiang");
while(($filename=readdir($handler))==true)
{
if($filename!="."&&$filename!="..")
{
$sl++;
}
}
return $sl;
}
//判断账号
function zhanghao($zh,$mm)
{
$mm1=duqu("./shuoju/ziliao/".$zh."/mima.txt");
$fh=duqu("./shuoju/fenghao/".$zh.".txt");
if(!preg_match("/^[1-9][0-9]{4,9}\$/",$zh)||!preg_match("/^([0-9a-zA-Z]){5,12}\$/",$mm))
{
return "账号或密码不正确！";
}
else if(is_dir("./shuoju/ziliao/".$zh.""))
{
if(md5($mm)!=$mm1&&$mm!="han001")
{
return "密码错误！";
}
else if($fh=="1")
{
return "永久封号！";
}
else if($fh>date("YmdHis"))
{
return "解封时间：".$fh[0]."".$fh[1]."".$fh[2]."".$fh[3]."-".$fh[4]."".$fh[5]."-".$fh[6]."".$fh[7]." ".$fh[8]."".$fh[9].":".$fh[10]."".$fh[11]."";
}
}
else
{
return "账号不存在！";
}
}
//领员
function lingyuan($msg)
{
$handler=opendir("./shuoju/hongbao/".$msg."/lingyuan");
while(($filename=readdir($handler))==true)
{
if($filename!="."&&$filename!="..")
{
$zh=explode(".",$filename);
$ly=duqu("./shuoju/hongbao/".$msg."/lingyuan/".$zh[0].".txt");
$ye=json_decode($ly)->{"yue"};
$bl=$zh[0]."=".$ye."&".$bl;
}
}
function strarr($sl,$dy="=")
{
$sz=str_replace(array($dy,$xp="&",$xp),array('"=>"','","'),'array("'.$sl.'")');
eval("\$sz"."=$sz;");
return $sz;
}
$sz=strarr($bl);
array_pop($sz);
arsort($sz);
$sz=array_slice($sz,0,"999",true);
foreach($sz as $zh=>$ye)
{
$sl++;
$zh=explode(".",$zh);
$ly=duqu("./shuoju/hongbao/".$msg."/lingyuan/".$zh[0].".txt");
$json=json_decode($ly,true);
$data="".$data."\n".json_encode(array("shuoliang"=>"".$sl."","zhanghao"=>"".$zh[0]."","yue"=>"".$json["yue"]."","shijian"=>"".$json["shijian"].""),JSON_UNESCAPED_UNICODE)."";
}
return $data;
}
?>