File size: 8.08Kb
<?php
#-----------------------------------------------------#
# ********* WAP-MOTORS ********* #
# Made by : VANTUZ #
# E-mail : [email protected] #
# Site : http://pizdec.ru #
# WAP-Site : http://visavi.net #
# ICQ : 36-44-66 #
# Вы не имеете право вносить изменения в код скрипта #
#-----------------------------------------------------#
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/maincore.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";
include_once"../themes/$config_themes/index.php";
$text = file("../local/profil/$log.prof");
if ($text!=""){
$udata = explode(":||:",$text[0]);
$provlog=trim($udata[0]);
$provpar=trim($udata[1]);
$dostup=trim($udata[7]);
$privat=trim($udata[10]);}
$time=time();
if (!$_SESSION['log']=="" && !md5($_SESSION['par'])=="" && md5($_SESSION['par'])==$provpar && $_SESSION['log']==$provlog ) {
if ($dostup==101 || $dostup==102 || $dostup==103){
echo'<img src="../images/img/menu.gif" alt=""> <b>Управление чатом</b><br>';
if(!isset($action)){
echo'<br><a href="chat.php?rand='.rand(0,99).'&'.SID.'">Обновить</a><br>';
$file = file("../local/chat.dat");
$total = count($file);
if (empty($_GET['start'])) $start = 0;
else $start = $_GET['start'];
if ($total < $start + $config_chatpost){ $end = $total;}
else {$end = $start + $config_chatpost; }
for ($fm = $start; $fm < $end; $fm++){
$file = file("../local/chat.dat");
$file = array_reverse($file);
$dt = explode("|",$file[$fm]);
$num=$total-$fm-1;
if($fm>=0){
echo'<div class=b><img src="../images/img/edit.gif" alt="">';
echo'<b><a href="../pages/anketa.php?uz='.$dt[1].'&'.SID.'"> '.$dt[1].' </a></b> ('.$dt[2].' / '.date("H:i",$dt[3]).')<br>';
echo'<a href="chat.php?action=edit&rd='.$num.'&start='.$start.'&'.SID.'">[Edit]</a> ';
echo'<a href="chat.php?action=del&rd='.$num.'&start='.$start.'&'.SID.'">[DEL]</a> ';
echo'<a href="ban.php?action=zaban&ips='.$dt[5].'&'.SID.'">[Бан]</a></div>';
echo $dt[0].'<br><small><font color="#CC00CC">['.$dt[4].','. $dt[5].']</font></small>';
echo'<br><br>';}
}
if($total<1){echo'Чат пуст<br>';}
echo'<hr>';
if ($start != 0) {echo '<a href="chat.php?start='.($start - $config_chatpost).'&'.SID.'"><-Назад </a> ';}else{echo'<-Назад ';}
echo'|';
if ($total > $start + $config_chatpost) {echo ' <a href="chat.php?start='.($start + $config_chatpost).'&'.SID.'">Далее-></a>';}else{echo' Далее->';}
$ba=ceil($total/$config_chatpost);
$ba2=$ba*$config_chatpost-$config_chatpost;
echo '<br><hr>Страницы:';
$asd=$start-($config_chatpost*3);
$asd2=$start+($config_chatpost*4);
if($asd<$total && $asd>0){echo ' <a href="chat.php?start=0&'.SID.'">1</a> ... ';}
for($i=$asd; $i<$asd2;)
{
if($i<$total && $i>=0){
$ii=floor(1+$i/$config_chatpost);
if ($start==$i) {
echo ' <b>'.$ii.'</b>';
}
else {
echo ' <a href="chat.php?start='.$i.'&'.SID.'">'.$ii.'</a>';
}}
$i=$i+$config_chatpost;}
if($asd2<$total){echo ' ... <a href="chat.php?start='.$ba2.'&'.SID.'">'.$ba.'</a>';}
echo '<br><br>Всего сообщений : '.$total.' <br>';
if ($total>1) {
echo'<br><img src="../images/img/error.gif" alt=""> <a href="chat.php?action=alldel&'.SID.'">Очистить чат!</a>';}}
//---------------------------------------- РЕДАКТИРОВАНИЕ -------------------------------------------//
if($action=="edit") {
$lines=file("../local/chat.dat");
if (isset($rd)) {
$dt=explode("|", $lines[$rd]);
$dt[0]=str_replace('<img src="../images/smiles/',':',$dt[0]);
$dt[0]=str_replace('.gif" alt="">','',$dt[0]);
$dt[6]=str_replace('<img src="../images/smiles/',':',$dt[6]);
$dt[6]=str_replace('.gif" alt="">','',$dt[6]);
echo'<br>Редактирование сообщения: <b>'.$dt[1].'</b>';
if($config_themes!=="wml"){
echo'<form action="chat.php?rd='.$rd.'&action=addedit&start='.$start.'&'.SID.'" method="POST">';
echo'Дата: <b>'.$dt[2].' - '.date("H:i",$dt[3]).'</b><br>';
echo'Cообщение:<br>';
echo'<textarea cols="50" rows="3" name="msg">'.$dt[0].'</textarea><br>';
echo'<input type="hidden" name="day" value="'.$dt[2].'">';
echo'<input type="hidden" name="timer" value="'.$dt[3].'">';
echo'<input type="hidden" name="name" value="'.$dt[1].'">';
echo'<input type="hidden" name="mobila" value="'.$dt[4].'">';
echo'<input type="hidden" name="ip" value="'.$dt[5].'">';
echo'<input type="hidden" name="msg2" value="'.$dt[6].'">';
echo'<br><input type="submit" value="Изменить"></form><hr>';
}else{
echo'<br>--------------------<br>';
echo'Дата: <br><input type="text" name="day" value="'.$dt[2].'"/><br>';
echo'Время: <br><input type="text" name="timer" value="'.$dt[3].'"/><br>';
echo'Cообщение:<br>';
echo'<input name="msg" value="'.$dt[0].'"/><br>';
echo'<anchor>Изменить';
echo'<go href="chat.php?rd='.$rd.'&action=addedit&start='.$start.'&'.SID.'" method="post">';
echo'<postfield name="day" value="$(day)"/>';
echo'<postfield name="timer" value="$(timer)"/>';
echo'<postfield name="msg" value="$(msg)"/>';
echo'<postfield name="name" value="'.$dt[1].'"/>';
echo'<postfield name="mobila" value="'.$dt[4].'"/>';
echo'<postfield name="ip" value="'.$dt[5].'"/>';
echo'<postfield name="msg2" value="'.$dt[6].'"/>';
echo'</go></anchor><br>--------------------<br>';
}
}else{echo'Произошла ошибка, не выбрана строка';}
echo'<br><img src="../images/img/back.gif" alt=""> <a href="chat.php?'.SID.'">В чат</a>';
}
//---------------------------------------- ИЗМЕНЕНИЕ СООБЩЕНИЯ -------------------------------------------//
if($action=="addedit") {
$name=check($name);
$msg=check($msg);
$day=check($day);
$timer=check($timer);
$mobila=check($mobila);
$ip=check($ip);
$msg2=check($msg2);
$msg = smiles($msg);
$msg2 = smiles($msg2);
$text=$msg.'|'.$name.'|'.$day.'|'.$timer.'|'.$mobila.'|'.$ip.'|'.$msg2.'||';
$text=preg_replace ("|[\r\n]+|si","",$text);
if (isset($rd)) {
$file=file("../local/chat.dat");
$fp=fopen("../local/chat.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
for ($i=0;$i< sizeof($file);$i++) {if ($rd!=$i) {fputs($fp,$file[$i]);} else {fputs($fp,"$text\r\n");}}
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
}
header ("Location: chat.php?start=$start&".SID);
}
//---------------------------------------- УДАЛЕНИЕ СООБЩЕНИЯ -------------------------------------------//
if($action=="del") {
if (isset($rd)) {
$file=file("../local/chat.dat");
$fp=fopen("../local/chat.dat","w");
flock ($fp,LOCK_EX);
for ($i=0;$i< sizeof($file);$i++) { if ($i==$rd) {unset($file[$i]);} }
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
}
header ("Location: chat.php?start=$start&".SID);
}
//---------------------------------------- ОЧИСТКА ЧАТА -------------------------------------------//
if($action=="alldel") {
$file=file("../local/chat.dat");
$fp=fopen("../local/chat.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
header ("Location: chat.php?".SID);
}
echo'<br><img src="../images/img/panel.gif" alt=""> <a href="index.php?'.SID.'">В админку</a><br>';
echo'<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a><br>';
} else {header ("Location: ../index.php?error&".SID);}
} else {header ("Location: ../index.php?error&".SID);}
include_once"../themes/$config_themes/foot.php";
?>