File size: 5.95Kb
<?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]);}
if (!$_SESSION['log']=="" && !md5($_SESSION['par'])=="" && md5($_SESSION['par'])==$provpar && $_SESSION['log']==$provlog ) {
if ($dostup==101 || $dostup==102 || $dostup==103 || $dostup==105){
echo'<img src="../images/img/menu.gif" alt=""> <b>Чат администрации</b><br>';
if($config_themes!=="wml"){
echo'<br><form action="admchat.php?action=add'.SID.'" method="post">';
echo'<b>Сообщение:</b><br>';
echo'<textarea cols="20" rows="3" name="msg">'.$imja.'</textarea><br>';
if($config_translit=="1"){
echo'Транслит: <input name="trans" type="checkbox" value="y" /><br>';}
echo'<input type="submit" value="Добавить" /></form>';
}
if($action=="add")
{
$name=$log;
$brow=check($brow);
$date=date("d.m.y");
$time=time();
$msg=check($msg);
$name=check($name);
if($trans=="y"){$msg=transliter($msg);}
$msg = antimat($msg);
$msg = smiles($msg);
$text=$msg.'|'.$name.'|'.$date.'|'.$time.'|'.$brow.'|'.$ip.'||||';
$text=preg_replace ("|[\r\n]+|si","",$text);
$fp=fopen("../local/admchat.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$text\r\n");
flock ($fp,LOCK_UN);
fclose($fp);
$file=file("../local/admchat.dat");
$i = count($file);
if ($i>=$config_maxpostchat) {
$fp=fopen("../local/admchat.dat","w");
flock ($fp,LOCK_EX);
unset($file[0]);
unset($file[1]);
unset($file[2]);
unset($file[3]);
unset($file[4]);
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);}
}
if($action=="del"){
if($dostup!=101) header ("Location: admchat.php?start=$start&".SID);
if (isset($rd)){
$file=file("../local/admchat.dat");
$fp=fopen("../local/admchat.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: admchat.php?start=$start&".SID);
}
echo'<br><a href="#down"><img src="../images/img/downs.gif" alt=""></a> ';
echo'<a href="admchat.php?'.SID.'">Обновить</a> | ';
echo'<a href="../pages/who.php?'.SID.'">Кто-Где</a><br>';
$file = file("../local/admchat.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 ($i = $start; $i < $end; $i++){
$file = file("../local/admchat.dat");
$file = array_reverse($file);
$data = explode("|",$file[$i]);
$i2=round($i+1);
$num=$total-$i-1;
$data[0]=eregi_replace("((https?|ftp)://[[:alnum:]_=/-]+(\\.[[:alnum:]_=/-]+)*(/[[:alnum:]+&._=/~%#]*(\\?[[:alnum:]?+&._=/%#]*)?)?)", "<a href='\\1'>\\1</a>", $data[0]);
$data[6]=preg_replace ("|[\r\n]+|si","",$data[6]);
$data[3]=date("H:i",$data[3]);
if(!empty($data[0])){
echo'</div><div class=b><img src="../images/img/edit.gif" alt="">';
echo'<b><a href="../pages/anketa.php?uz='.$data[1].'&'.SID.'">'.$data[1].'</a></b><small> ('.$data[2].' '.$data[3].') </small>';
if($dostup==101){echo'<a href="admchat.php?action=del&rd='.$num.'&start='.$start.'&'.SID.'">[DEL]</a>';}
echo'</div><div>'.$data[0].'<br><font color="#CC00CC">('.$data[4].', '.$data[5].')</font><br>';
}
}
echo'<hr>';
if ($start != 0) {echo '<a href="admchat.php?start='.($start - $config_chatpost).'&'.SID.'"><-Назад</a> ';}else{echo'<-Назад ';}
echo'|';
if ($total > $start + $config_chatpost) {echo ' <a href="admchat.php?start='.($start + $config_chatpost).'&'.SID.'">Далее -></a>';}else{echo' Далее->';}
if($total>0){
$ba=ceil($total/$config_chatpost);
$ba2=$ba*$config_chatpost-$config_chatpost;
echo '<br><hr>Страницы:';
$asd=$start-($config_chatpost*4);
$asd2=$start+($config_chatpost*5);
if($asd<$total && $asd>0){echo ' <a href="admchat.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="admchat.php?start='.$i.'&'.SID.'">'.$ii.'</a>';
}}
$i=$i+$config_chatpost;}
if($asd2<$total){echo ' ... <a href="admchat.php?start='.$ba2.'&'.SID.'">'.$ba.'</a>';}
}
echo'<hr><a href="#up"><img src="../images/img/ups.gif" alt=""></a> <a href="admchat.php?'.SID.'">Обновить</a> | ';
echo'<a href="../pages/smiles.php?'.SID.'">Смайлы</a><br>';
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";
?>