<?php
#-----------------------------------------------------#
#          ********* WAP-MOTORS *********             #
#             Made by   :  VANTUZ                     #
#               E-mail  :  visavi.net@mail.ru         #
#                 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";

##########################################################################
##                         Главная страница 
##########################################################################

echo '<img src="../images/img/partners.gif" alt=""> <b>Администрация сайта</b><br><br>';

$filtime=filemtime(BASEDIR."local/datatmp/adminlist.dat");
$userfile=file(BASEDIR."local/datatmp/adminlist.dat");

$filtime=$filtime+(3600*$config_adminlistcache);

if($sitetime>$filtime){

foreach (glob(BASEDIR."local/profil/*.prof") as $filename) {
$array_allusers[] = basename($filename);
}

foreach($array_allusers as $value){

$tex = file(BASEDIR."local/profil/$value");
$data = explode(":||:",$tex[0]);
if($data[7]>=101 && $data[7]<=105){

$dat_user[]=$data[0];
$dat_status[]=$data[7];
}

}


asort($dat_status);	

foreach($dat_status as $k=>$v){
$admin_top[]='|'.$dat_user[$k].'|'.$dat_status[$k].'|';	
}
	
$admin_top=implode("\r\n",$admin_top);

if($admin_top!=""){
$fp = fopen(BASEDIR."local/datatmp/adminlist.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
fputs($fp,"$admin_top\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
@chmod ($fp, 0666); 
@chmod (BASEDIR."local/datatmp/adminlist.dat", 0666); 	
}
}



//------------------------------ ВЫВОД ИЗ КЕША ------------------------------//	
$userfile=file(BASEDIR."local/datatmp/adminlist.dat");
$total=count($userfile);
foreach($userfile as $key=>$value){

$userdata = explode("|",$value);

echo '<img src="../images/img/chat.gif" alt=""> '.($key+1).'. <b><a href="../pages/anketa.php?uz='.$userdata[1].'&amp;'.SID.'">'.nickname($userdata[1]).'</a></b>  ('.user_status($userdata[2]).') '.user_online($userdata[1]).'<br>';	
}

echo '<br>Всего <b>'.(int)$total.'</b> чел. в администрации<br>';


//---------------------------------  Быстрая почта ----------------------------------//
if ($provlog==$_SESSION['log'] && $provpar==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!=""){


echo'<hr><big><b>Быстрая почта</b></big><br><br>';

if($config_themes!=="wml"){
echo'<form method="post" action="addpriv.php?'.SID.'">';


echo 'Выберите адресат:<br><select name="uz">';

foreach($userfile as $value){
$userdata = explode("|",$value);

if($log!=$userdata[1]){
echo '<option value="'.$userdata[1].'"> '.$userdata[1].' </option>';
}}

echo '</select><br>';



echo'Текст:<br>';
echo'<textarea cols="25" rows="3" name="mess"></textarea><br>';

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

echo'<input value="Отправить" name="do" type="submit" /></form><hr>';

}else{

echo 'Выберите адресат:<br><select name="uz">';

foreach($userfile as $value){
$userdata = explode("|",$value);

if($log!=$userdata[1]){
echo '<option value="'.$userdata[1].'"> '.$userdata[1].' </option>';
}}

echo '</select><br>';


echo'Текст:<br>';
echo'<input name="mess"/><br>';

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

echo'<anchor>Отправить';
echo'<go href="addpriv.php?'.SID.'" method="post">';
echo'<postfield name="trans" value="$(trans)"/>';
echo'<postfield name="uz" value="$(uz)"/>';
echo'<postfield name="mess" value="$(mess)"/>';
echo'</go></anchor><br>--------------------<br>'; 
}
}

echo'<br><img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a><br>';

include_once"../themes/$config_themes/foot.php";
?>
