<?
$ref=rand(100,10000000);
header("Content-type:text/vnd.wap.wml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.dtd\">";
echo "<wml>\n";
echo "<head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>";
echo "<card id=\"index\" title=\"Модер-панель\">";
echo "<p align=\"left\">";
$log = htmlspecialchars(stripslashes($log));
$pas = htmlspecialchars(stripslashes($pas));
/////////////////////////////////////////////////////
$text = @file("../data/reg/$log.dat");
if ($text!=""){
$udata = explode(":||:",$text[0]);
$login=trim($udata[0]);
$password=trim($udata[1]);}
////////////////////////////////////////////////////////
if (md5($pas)==$password && $log==$login && $log!=="" && md5($pas)!=="") {
$u = explode(".",$login);
if($log=="$u[0].GM"){
switch(@$go) {
default:
function img($image) {return eregi_replace("pic/","../pic/", $image);} ob_start("img");
if(empty($udata[35])){$udata[35]="5";}
$file = @file("../data/chat.dat");
$total = count($file);
if (empty($_GET['start'])) $start = 0;
else $start = $_GET['start'];
if ($total < $start + $udata[35]){ $end = $total; }
else {$end = $start + $udata[35]; }
for ($i = $start; $i < $end; $i++){
$file = @file("../data/chat.dat");
$file = array_reverse($file);
$data = explode("#",$file[$i]);
$i2=round($i+1);
if(!empty($data[1])){
echo"<small><b><a href=\"chat.php?log=$log&pas=$pas&go=del&id=$i\">[DEL]</a><a href=\"chat.php?log=$log&pas=$pas&go=ignor&name=$data[1]\">[IGNOR]</a></b> <a href=\"../search.php?log=$log&pas=$pas&go=go&nick=$data[1]\">$data[1]</a></small> - <small>$data[0]<br/>[$data[2]/$data[3]]</small><br/>";}
}
echo"<br/><b><small>= = = =</small></b>";
echo "<br/><input name=\"msg\" maxlength=\"999\" title=\"msg\"/><br/>";
echo "<small><anchor title=\"go\">Написать<go href=\"chat.php?log=$log&pas=$pas&go=add\" method=\"post\">";
echo "<postfield name=\"msg\" value=\"$(msg)\"/>";
echo "</go></anchor></small><br/>";
if ($start != 0) {echo '<small><a href="chat.php?start='.($start - $udata[35]).'&log='.$log.'&pas='.$pas.'">Назад</a></small> ';}else{echo'<small>= = = =</small><br/>';}
if ($total > $start + $udata[35]) {echo ' <small><a href="chat.php?start='.($start + $udata[35]).'&log='.$log.'&pas='.$pas.'">Далее</a></small>';}
echo"<br/><small><a href=\"chat.php?log=$log&pas=$pas&ref=$ref\">Обновить</a></small><br/>";
break;
case 'add':
if(getenv("HTTP_X_FORWARDED_FOR")){ $ip = getenv("HTTP_X_FORWARDED_FOR"); }else{
if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");}
$ip=htmlspecialchars(stripslashes($ip));
$brow=htmlspecialchars(stripslashes(getenv('HTTP_USER_AGENT')));
$brow=strtok($brow,'/');
$brow=str_replace("#","",$brow);
$ip=str_replace("#","",$ip);
$msg=htmlspecialchars(stripslashes($msg));
$msg=str_replace("#","",$msg);
$date=date("d.m.y");
$time=date("H:i");
$text="$msg#$log###";
$text=str_replace("\r\n", "", $text);
$fp=fopen("../data/chat.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$text\r\n");
flock ($fp,LOCK_UN);
fclose($fp);
$file=file("../data/chat.dat"); $i = count($file);
if ($i>=1000) {
$fp=fopen("../data/chat.dat","w");
flock ($fp,LOCK_EX);
unset($file[0]);
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
}
echo"<small><a href=\"chat.php?log=$log&pas=$pas\">Сообщение добавлено!</a></small><br/>";
break;
case 'del':
$file = @file("../data/chat.dat");
$total = count($file);
if($id=="0"){$id=$total-1;}else{$id=$total-$id-1;}
$file=file("../data/chat.dat");
$fp=fopen("../data/chat.dat","w");
flock ($fp,LOCK_EX);
for ($i=0;$i< sizeof($file);$i++) { if ($i==$id) {unset($file[$i]);} }
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
echo"<small><a href=\"chat.php?log=$log&pas=$pas\">Удалено.</a></small>";
break;
case 'ignor':
$name=htmlspecialchars(stripslashes($name));
echo "<small>Причина:</small><br/><input name=\"prichina\" maxlength=\"999\"/><br/>";
echo "<small><anchor title=\"go\">Банить<go href=\"chat.php?log=$log&pas=$pas&go=ban&name=$name\" method=\"post\">";
echo "<postfield name=\"prichina\" value=\"$(prichina)\"/>";
echo "</go></anchor></small><br/>";
break;
case 'ban':
$name=htmlspecialchars(stripslashes($name));
$file=@file("../data/chat.dat");
$file = array_reverse($file);
$total=count($file);
for($i=0; $i<$total; $i++){
$data = explode("#",$file[$i]);
if($name==$data[1]){
$ip=explode(".",$data[3]);
$ipn="$ip[0].$ip[1].$ip[2]";
$time=time();
$prichina=htmlspecialchars(stripslashes($prichina));
$prichina=str_replace("|","",$prichina);
$name=str_replace("|","",$name);
$text="$ipn||$time||$name||$prichina||$data[0]||";
$fp=fopen("../data/ban.dat","a+");
flock($fp,LOCK_EX);
fputs($fp,"$text\r\n");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
echo"<small><a href=\"chat.php?log=$log&pas=$pas\">$name забанен на 24 часа.</a></small><br/>";
echo"<small>- - -<br/>» <a href=\"../main.php?log=$log&pas=$pas\">Моё меню</a></small></p></card></wml>";
exit;}
}
break;
}}
}else{echo"<small>Пароль или логин неверен!</small>";}
echo"<small>- - -<br/>» <a href=\"../main.php?log=$log&pas=$pas\">Моё меню</a></small></p></card></wml>";
?>