Просмотр файла mpanel/adminchat.php

Размер файла: 6.96Kb
<?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/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";
include_once"../template/isset.php";


$rand =rand(100,999); 
$dates=date("d.m.y");
$times=date("H:i");  

if ($provlog==$_SESSION['log'] && $provpar==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!="") {
if ($dostup==101 || $dostup==102 || $dostup==103 || $dostup==105){

##########################################################################
##                         Главная страница 
##########################################################################
if(!isset($action)){
echo '<img src="../images/img/menu.gif" alt=""> <b>Админ-чат</b><br><br>';
if($config_themes!="wml"){echo '<a href="#down"><img src="../images/img/downs.gif" alt=""></a> ';}
echo '<a href="adminchat.php?r='.$rand.'&amp;'.SID.'"> Обновить</a><br>';

	
if($config_themes!="wml"){	
echo'<hr><form action="adminchat.php?action=add&amp;'.SID.'" method="post"><b>Сообщение:</b><br>';
echo'<textarea cols="25" rows="3" name="msg"></textarea><br>';

if($config_translit=="1"){
echo'Транслит: <input name="trans" type="checkbox" value="y" /><br>';}

echo'<input type="submit" value="Написать" /></form><hr>';

}else{

echo'<br>--------------------<br>Сообщение:<br>';
echo'<input name="msg"/><br>';

if($config_translit=="1"){
echo'Транслит: <select name="trans"><option value="0">Нет</option>';
echo'<option value="y">Да</option></select><br>';}

echo'<anchor>Написать';
echo'<go href="adminchat.php?action=add&amp;'.SID.'" method="post">';
echo'<postfield name="msg" value="$(msg)"/>';
echo'<postfield name="trans" value="$(trans)"/>';
echo'</go></anchor><br>--------------------<br>';
}



$file = file("../local/adminchat.dat");
$file = array_reverse($file);
$total = count($file);    
if($total<1){echo'<br><img src="../images/img/reload.gif" alt=""> <b>Сообщений нет, будь первым!</b><br>';}
if (empty($_GET['start'])) $start = 0;
else $start = $_GET['start'];
if ($total < $start + $config_bookpost){ $end = $total; }
else {$end = $start + $config_bookpost; }
for ($i = $start; $i < $end; $i++){



$data = explode("|",$file[$i]);
//////////////////////////////////////////////////////////////
$statwho='<font color="red">[Off]</font>';
  $sublines=file("../local/online.dat"); 
$subcount=count($sublines);
for ($b=0; $b<$subcount; $b++) {$dt=explode("#",$sublines[$b]); if ($data[1]==$dt[2]) 
{$statwho='<font color="#00FF00">[On]</font>';}}


///////////////////////////////////////////////////////////////
$data[0]=bb_code($data[0]);

if(!empty($udata[45])){
$ava = file("../local/profil/$data[1].prof"); 
$avv = explode(":||:",$ava[0]);

if($avv[43]!="" && $avv[43]!="noavatar.gif"){
echo'<div class=b><img src="../'.$avv[43].'" alt=""> ';}else{
echo'<div class=b><img src="../images/avators/noavatar.gif" alt=""> '; }	
echo'<b><a href="../pages/anketa.php?uz='.$data[1].'&amp;'.SID.'"> '.$data[1].' </a></b> '.$statwho;
}else{ echo'<div class=b><img src="../images/img/edit.gif" alt=""> <b><a href="../pages/anketa.php?uz='.$data[1].'&amp;'.SID.'"> '.$data[1].' </a></b> '.$statwho;}
 

if($dates==$data[2]){$data[2]='<font color="#FF0000">Сегодня</font>';}

	
echo'<small> ('.$data[2].' / '.$data[3].')</small></div>'.$data[0].'<br><small><font color="#CC00CC">['.$data[4].', '. $data[5].']</font></small>'; 
echo'<br>';

}

echo'<hr>'; 
if ($start != 0) {echo '<a href="adminchat.php?start='.($start - $config_bookpost).'&amp;'.SID.'">&lt;-Назад </a> ';}else{echo'&lt;-Назад ';}
echo'|'; 
if ($total > $start + $config_bookpost) {echo ' <a href="adminchat.php?start='.($start + $config_bookpost).'&amp;'.SID.'"> Далее-&gt;</a>';}else{echo' Далее-&gt;';}

if($total>0){

$ba=ceil($total/$config_bookpost);
$ba2=$ba*$config_bookpost-$config_bookpost;

echo '<br><hr>Страницы:';
$asd=$start-($config_bookpost*3);
$asd2=$start+($config_bookpost*4);

if($asd<$total && $asd>0){echo ' <a href="adminchat.php?start=0&amp;'.SID.'">1</a> ... ';}

for($i=$asd; $i<$asd2;)
{
if($i<$total && $i>=0){
$ii=floor(1+$i/$config_bookpost);

if ($start==$i) {
echo ' <b>('.$ii.')</b>';
               }
                else {
echo ' <a href="adminchat.php?start='.$i.'&amp;'.SID.'">'.$ii.'</a>';
                     }}


$i=$i+$config_bookpost;}
if($asd2<$total){echo ' ... <a href="adminchat.php?start='.$ba2.'&amp;'.SID.'">'.$ba.'</a>';}
}

echo '<br><br>';
if($config_themes!="wml"){echo '<a href="#up"><img src="../images/img/ups.gif" alt=""></a> ';}

echo '<a href="../pages/smiles.php?'.SID.'">Смайлы</a> | ';
echo '<a href="../pages/tegi.php?'.SID.'">Теги</a><br>';
}


//---------------------------------------- ДОБАВЛЕНИЕ СООБЩЕНИЯ -------------------------------------------//
if($action=="add") {

$brow=check($brow);
$msg=wordwrap($msg,150,' ',1);
$msg=substr($msg,0,1200);
$msg=check($msg);
$log=check($log);

	
////////////////////////////////////////
if($trans=="y"){$msg=transliter($msg);}
$msg = antimat($msg);
$msg = smiles($msg);
////////////////////////////////////////
$text=$msg.'|'.$log.'|'.$dates.'|'.$times.'|'.$brow.'|'.$ip.'|';
$text=preg_replace ("|[\r\n]+|si","",$text);

$fp=fopen("../local/adminchat.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$text\r\n");
flock ($fp,LOCK_UN);
fclose($fp);


$file=file("../local/adminchat.dat"); $i = count($file);
if ($i>=100) {
$fp=fopen("../local/adminchat.dat","w");
flock ($fp,LOCK_EX);
unset($file[0]);
unset($file[1]);
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
}


header ("Location: adminchat.php?isset=addon&".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";
?>