File size: 5.7Kb
<?php
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";
$uz=check($uz);
echo '<img src="../images/img/partners.gif" alt=""> <b>Рейтинг чата</b><br><br>';
//------------------------------ НОВАЯ ФУНКЦИЯ КЕШИРОВАНИЯ ------------------------------//
$filtime=filemtime(BASEDIR."local/datatmp/topchat.dat");
$userfile=file(BASEDIR."local/datatmp/topchat.dat");
$user_count=count($userfile);
$filtime=$filtime+(3600*$config_avtorlistcache);
if($sitetime>$filtime || $user_count<50){
foreach (glob(BASEDIR."local/profil/*.prof") as $filename) {
$a[] = basename($filename);
}
$total = count($a);
for ($i = 0; $i < $total; $i++){
$tex = file(BASEDIR."local/profil/$a[$i]");
$data = explode(":||:",$tex[0]);
if($data[12]>0 && $data[0]!=""){
$dat_log[]=$data[0];
$dat_reg[]=$data[6];
$dat_topchat[]=$data[12];
}}
arsort($dat_topchat);
foreach($dat_topchat as $k=>$v){ $gg++;
}
$dat_top=implode("\r\n",$dat_top);
if($dat_top!=""){
$fp = fopen(BASEDIR."local/datatmp/topchat.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
fputs($fp,"$dat_top\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
chmod ($fp, 0666);
chmod (BASEDIR."local/datatmp/topchat.dat", 0666);
}
}
//------------------------------ ВЫВОД ИЗ КЕША ------------------------------//
$file = file(BASEDIR."local/datatmp/topchat.dat");
$total = count($file);
$start = (int)$_GET['start'];
if($start < 0 || $start > $total){$start = 0;}
if ($total < $start + $config_avtorlist){ $end = $total; }
else {$end = $start + $config_avtorlist; }
for ($i = $start; $i < $end; $i++){
$data = explode("|",$file[$i]);
$ava = file(BASEDIR."local/profil/$data[2].prof"); $avv = explode(":||:",$ava[0]);
echo '<div class=b>';
if(!empty($udata[45])){if($avv[43]!="" && $avv[43]!="noavatar.gif"){echo'<img src="../'.$avv[43].'" alt=""> ';}else{echo'<img src="../images/avators/noavatar.gif" alt=""> '; }}
if($uz==$data[2]){
echo '<b><big><a href="../pages/anketa.php?uz='.$data[2].'&'.SID.'"><font color="#FF0000">'.nickname($data[2]).'</font></a></big></b> ';
}else{
echo '<b><a href="../pages/anketa.php?uz='.$data[2].'&'.SID.'">'.nickname($data[2]).'</a></b> ';
}
if($avv[15]=="M"){echo' <img src="../images/img/man.gif" alt=""> ';}else{if($avv[15]=="Ж"){echo' <img src="../images/img/woman.gif" alt=""> ';}}
echo' '.user_online($data[2]).'<br>'.user_title($data[2]).'<br>';
$uzertime=substr($avv[18],0,5);$montime=date_fixed($sitetime,"d.m");if($uzertime==$montime){echo'<font color="#FF0000"><b>Пользователь,отмечает день рождения!</b></font><br>';}
echo '</div>Сообщений в чате: '.(int)$data[3].'</br>';
if ($avv[6]!="") {echo 'Дата регистрации: '.date_fixed($avv[6]).'<br>';}
}
echo '<hr>';
if ($start != 0) {echo '<a href="topchat.php?start='.($start - $config_avtorlist).'&'.SID.'"><-Назад </a>';}else{echo'<-Назад';}
echo ' | ';
if ($total > $start + $config_avtorlist) {echo ' <a href="topchat.php?start='.($start + $config_avtorlist).'&'.SID.'">Далее-></a>';}else{echo'Далее->';}
if($total>0){
$ba=ceil($total/$config_avtorlist);
$ba2=$ba*$config_avtorlist-$config_avtorlist;
echo '<br><hr>Страницы:';
$asd=$start-($config_avtorlist*4);
$asd2=$start+($config_avtorlist*5);
if($asd<$total && $asd>0){echo ' <a href="topchat.php?start=0&'.SID.'">1</a> ... ';}
for($i=$asd; $i<$asd2;){
if($i<$total && $i>=0){
$ii=floor(1+$i/$config_avtorlist);
if ($start==$i) {
echo ' <b>('.$ii.')</b>';
} else {
echo ' <a href="topchat.php?start='.$i.'&'.SID.'">'.$ii.'</a>';
}}
$i=$i+$config_avtorlist;}
if($asd2<$total){echo ' ... <a href="topchat.php?start='.$ba2.'&'.SID.'">'.$ba.'</a>';}
}
//-----------------------------------------------------------------//
if($uz==""){
echo '<hr><b>Поиск пользователя:</b><br>';
if($config_themes!="wml"){
echo '<form action="topchat.php?start='.$start.'&'.SID.'" method="post">';
echo'<input name="uz" value="'.$log.'" /><br>';
echo '<input type="submit" value="Искать" /></form><hr>';
}else{
echo'<input name="uz" value="'.$log.'"/><br>';
echo'<anchor>Искать';
echo'<go href="topchat.php?start='.$start.'&'.SID.'" method="post">';
echo'<postfield name="uz" value="$(uz)"/>';
echo'</go></anchor><br>--------------------';
}
}else{
$file = file(BASEDIR."local/datatmp/topchat.dat");
$total = count($file);
for ($i = 0; $i < $total; $i++){
$data = explode("|",$file[$i]);
if (trim($uz)==$data[2]){
$stranica = floor($i / $config_avtorlist) * $config_avtorlist;
if($start!=$stranica){
header ("Location: topchat.php?start=$stranica&uz=$uz&".SID);
}
$pos = $i + 1;
echo '<hr><br><font color="#00FF00">Позиция в рейтинге:</font> <b>'.$pos.'</b><br>';
break;
}}
if($pos==""){ echo '<hr><br><b><font color="#FF0000">Пользователь с таким логином не найден!</font></b><br>';}
echo '<br><a href="topchat.php?start='.$start.'&'.SID.'">Искать еще</a><br>';
}
echo '<br>Всего юзеров: <b>'.(int)$total.'</b><br><br>';
echo '<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';
include_once "../themes/$config_themes/foot.php";
?>