Просмотр файла userlist.php

Размер файла: 5.41Kb
<?php
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);
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";
$text = @file("../../local/profil/$log.prof");
if ($text!=""){
$udata = explode(":||:",$text[0]);
$provlog=trim($udata[0]);
$provpar=trim($udata[1]);
$dostup=trim($udata[7]);
$privat=trim($udata[10]);}

$date=date("d.m");
$time=date("H:i");
////////////////////////////////////////////////////////
require_once"top.php";
echo'';
	require_once"times.php";
	echo'
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
	<tr>

	  <th class="thTop" nowrap="nowrap">Приват</th>
	  <th class="thTop" nowrap="nowrap">Логин</th>
	  <th class="thTop" nowrap="nowrap">Статус</th>
	  <th class="thTop" nowrap="nowrap">Баллов</th>
	  <th class="thTop" nowrap="nowrap">Дата регистрации</th>
	  <th class="thTop" nowrap="nowrap">Постов на форуме</th>
	  ';



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

//------------------------------ НОВАЯ ФУНКЦИЯ КЕШИРОВАНИЯ ------------------------------//
$filtime=filemtime("../../local/datatmp/userlist.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_komm[]=$data[33];
$dat_chat[]=$data[12];
$dat_vhod[]=$data[11];
$dat_guest[]=$data[9];
$dat_forum[]=$data[8];
$dat_reg[]=$data[6];
$dat_log[]=$data[0];
$dat_ball[]=$data[36];
}


arsort($dat_ball);


foreach($dat_ball as $k=>$v)
{$uz=$dat_log[$k];	$postsall=$v;
include"../../template/statuses.php";
$gg++;
$dat_ball2[]='|'.$gg.'|'.$dat_log[$k].'|'.$statuses.'|'.$v.'|'.$dat_forum[$k].'|'.$dat_guest[$k].'|'.$dat_chat[$k].'|'.$dat_komm[$k].'|'.$dat_vhod[$k].'|'.$dat_reg[$k].'|';	}

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

for ($i = 0; $i < $total; $i++){
$fp = fopen("../../local/datatmp/userlist.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/userlist.dat", 0666);
}
}



//------------------------------ ВЫВОД ИЗ КЕША ------------------------------//
$file = file("../../local/datatmp/userlist.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'</tr>
	<tr>

	  <td class="row1" align="center">&nbsp;<a href="../../pages/privat.php?action=submit&uz='.$data[2].'"><img src="icon_pm0.gif" alt="Отправить личное сообщение" title="Отправить личное сообщение" border="0" /></a>&nbsp;</td>
	  <td class="row1" align="center"><span class="gen"><a href="anketa.php?uz='.$data[2].'&amp;'.SID.'" class="gen">'.$data[2].'</a></span></td>
	  <td class="row1" align="center" valign="middle"><span class="gen">'.$data[3].'</span></td>
	  <td class="row1" align="center" valign="middle"><span class="gen">'.$data[4].'</span></td>
	  <td class="row1" align="center" valign="middle"><span class="gensmall">'.$data[10].'</span></td>
	  <td class="row1" align="center" valign="middle"><span class="gen">'.$data[5].'</span></td>
	  ';
}

echo'<hr>';
if ($start != 0) {echo '<a href="userlist.php?start='.($start - $config_userlist).'&amp;'.SID.'">&lt;-Назад </a> ';}else{echo'&lt;-Назад ';}
echo'|';
if ($total > $start + $config_userlist) {echo ' <a href="userlist.php?start='.($start + $config_userlist).'&amp;'.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="userlist.php?start=0&amp;'.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="userlist.php?start='.$i.'&amp;'.SID.'">'.$ii.'</a>';
                     }}


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

echo '<br><br>Всего юзеров: '.$total.'<br><br>';



echo'
</tr>
	<tr>
	  <td class="catBottom" colspan="8" height="28">&nbsp;</td>
	</tr>
  </table>
  <table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
	<tr>
	  <td align="right" valign="top"></td>
	</tr>';
require_once"foot.php";
exit;
?>