Размер файла: 4.4Kb
<?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";
$uz=check($uz);
echo '<img src="../images/img/partners.gif" alt=""> <b>Топ самых активных на форуме</b><br><br>';
//------------------------------ НОВАЯ ФУНКЦИЯ КЕШИРОВАНИЯ ------------------------------//
$filtime=filemtime("../local/datatmp/topusers.dat");
$userfile=file("../local/datatmp/topusers.dat");
$user_count=count($userfile);
$filtime=$filtime+(3600*$config_userforumcache);
if($sitetime>$filtime || $user_count<50){
$dir = opendir ("../local/profil");
while ($file = readdir ($dir)) {
if (ereg ("\.prof$", $file)) {
$alltopusers[]=$file;}}
closedir ($dir);
$total = count($alltopusers);
for ($i = 0; $i < $total; $i++){
$tex = file("../local/profil/$alltopusers[$i]");
$data = explode(":||:",$tex[0]);
if($data[8]>0 && $data[0]!=""){
$dat_log[]=$data[0];
$dat_forum[]=$data[8];
}}
arsort($dat_forum);
foreach($dat_forum as $k=>$v){ $gg++;
$dat_top[]='|'.$gg.'|'.$dat_log[$k].'|'.$dat_forum[$k].'|';
}
$dat_top=implode("\r\n",$dat_top);
if($dat_top!=""){
$fp = fopen("../local/datatmp/topusers.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 ("../local/datatmp/topusers.dat", 0666);
}
}
//------------------------------ ВЫВОД ИЗ КЕША ------------------------------//
$file = file("../local/datatmp/topusers.dat");
$total = count($file);
$start = (int)$_GET['start'];
if($start < 0 || $start > $total){$start = 0;}
if ($total < $start + $config_topforums){ $end = $total; }
else {$end = $start + $config_topforums; }
for ($i = $start; $i < $end; $i++){
$data = explode("|",$file[$i]);
echo $data[1].'. <img src="../images/img/chel.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>';}
echo ' (Сообщений: <b>'.$data[3].'</b>)<hr>';
}
if ($start != 0) {echo '<a href="topusers.php?start='.($start - $config_topforums).'&'.SID.'"><-Назад</a> ';}else{echo'<-Назад';}
echo' | ';
if ($total > $start + $config_topforums) {echo ' <a href="topusers.php?start='.($start + $config_topforums).'&'.SID.'">Далее-></a>';}else{echo'Далее->';}
if($total>0){
$ba=ceil($total/$config_topforums);
$ba2=$ba*$config_topforums-$config_topforums;
echo '<br><hr>Страницы:';
$asd=$start-($config_topforums*4);
$asd2=$start+($config_topforums*5);
if($asd<$total && $asd>0){echo ' <a href="topusers.php?start=0&'.SID.'">1</a> ... ';}
for($i=$asd; $i<$asd2;){
if($i<$total && $i>=0){
$ii=floor(1+$i/$config_topforums);
if ($start==$i) {
echo ' <b>('.$ii.')</b>';
} else {
echo ' <a href="topusers.php?start='.$i.'&'.SID.'">'.$ii.'</a>';
}}
$i=$i+$config_topforums;}
if($asd2<$total){echo ' ... <a href="topusers.php?start='.$ba2.'&'.SID.'">'.$ba.'</a>';}
}
echo '<br>Всего юзеров: <b>'.(int)$total.'</b><br>';
echo '<br><img src="../images/img/reload.gif" alt=""> <a href="index.php?'.SID.'">В форум</a><br>';
echo '<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';
include_once"../themes/$config_themes/foot.php";
?>