Просмотр файла pages/raitinglist.php

Размер файла: 5.33Kb
<?php
#-----------------------------------------------------#
#     **** WAP-MOTORS AutoDetect XHTML/WML ****       #
#-----------------------------------------------------#
#     Original Made by  :  VANTUZ                     #
#               E-mail  :  [email protected]             #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#-----------------------------------------------------#
#   AutoDetect Made by  :  X-ray (Юрий)               #
#               E-mail  :  [email protected]           #
#                 Site  :  http://zugdidi.us          #
#             WAP-Site  :  http://geowap.mobi         #
#-----------------------------------------------------#
#  Вы не имеете право вносить изменения в код скрипта #
#-----------------------------------------------------#
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]);
$privat=trim($udata[10]);}


echo '<img src="../images/img/partners.gif" alt=""> <b><font color="#FFFF00"> Рейтинг толстосумов</font></b><br><br>';

$dir = opendir ("../local/profil"); 
while ($file = readdir ($dir)) 
{if (ereg (".prof$", $file)) 
{$a[]=$file;}} 
closedir ($dir); 		
$total = count($a); 


//------------------------------ НОВАЯ ФУНКЦИЯ КЕШИРОВАНИЯ ------------------------------//
$filtime=filemtime("../local/datatmp/raitinglist.dat");
$filtime=$filtime+(3600*12); //12-часовое индексирование 
$ttime=time();

if($ttime>=$filtime){

for ($i = 0; $i < $total; $i++){
$tex = file("../local/profil/$a[$i]");
$data = explode(":||:",$tex[0]);


$dat_log[]=$data[0]; 
$dat_gold[]=$data[41];
}

arsort($dat_gold);

foreach($dat_gold as $k=>$v)
{$uz=$dat_log[$k];
$usersum="0";
$lines=file("../local/bank.dat"); 
$county=count($lines);
for ($b=0; $b<$county; $b++) {
$dty=explode("|",$lines[$b]); if ($dty[1]==$uz) {$usersum=$dty[2];}} 

$ob_summa=$v+$usersum;

$dat_log3[]=$dat_log[$k]; 
$dat_bank3[]=$usersum; 
$dat_gold3[]=$ob_summa; 
$dat_ruki[]=$v;
}

arsort($dat_gold3);	
	
foreach($dat_gold3 as $k2=>$v2)
{
	
$gg++;
$dat_ball2[]='|'.$gg.'|'.$dat_log3[$k2].'|'.$v2.'|'.$dat_ruki[$k2].'|'.$dat_bank3[$k2].'|';		

}

$fp=fopen("../local/datatmp/raitinglist.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);	
chmod ($fp, 0666); 
chmod ("../local/datatmp/raitinglist.dat", 0666); 		

for ($i = 0; $i < $total; $i++){
$fp = fopen("../local/datatmp/raitinglist.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$dat_ball2[$i]\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
chmod ($fp, 0666); 
chmod ("../local/datatmp/raitinglist.dat", 0666); 
}
}
	

//------------------------------ ВЫВОД ИЗ КЕША ------------------------------//	
$file = file("../local/datatmp/raitinglist.dat");
$total = count($file);
if ($start=="") {$start = 0;} 
if ($total < $start + $config_userlist){ $end = $total; }
else {$end = $start + $config_userlist; }
for ($i = $start; $i < $end; $i++){

$data = explode("|",$file[$i]);

echo '<div class=b><b>'.$data[1].'.<img src="../images/img/chel.gif" alt=""> ';
echo '<a href="../pages/anketa.php?uz='.$data[2].'&amp;'.$detect_wap.''.SID.'">'.$data[2].'</a></b> ('.(int)$data[3].' монет)</div>';
echo 'На руках: '.(int)$data[4].'<br>В банке: '.(int)$data[5].'<br>';
}
  

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

if($total>0){

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

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

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

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

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


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


echo '<br><br>Всего юзеров: '.$total.'<br>';
echo'<a href="../index.php?'.$detect_wap.''.SID.'">На главную</a>';
include_once"../themes/$config_themes/foot.php";
?>