Файл: DarkAge/gm/chat2.php
Строк: 70
<?
$ref=rand(100,10000000);
$_title = 'GM-панель';
include '../files/header2.php';
$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(@file("../data/admin/$log.dat")){
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><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 "<form action="chat.php?log=$log&pas=$pas&go=add" method="post"><br/><b><small>= = = =</small></b>";
echo "<br/><input name="msg" maxlength="999" title="msg"/><br/>";
echo '<input type="submit" value="Написать" /></form>';
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="[$time]<br/><b>$msg</b>#</b><a href="search.php?log=$log&pas=$pas&go=go&nick=$log">$log</a></b>###";
$text=str_replace("rn", "", $text);
$fp=fopen("../data/chat.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$textrn");
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));
print "причина";
echo "<form action="chat.php?log=$log&pas=$pas&go=ban&name=$name" method="post"><";
echo "<br/><input name="prichina" maxlength="999"/><br/>";
echo '<input type="submit" value=",банить" /></form>';
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,"$textrn");
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>";
?>