<?php
define('NTOP', 1);
$title = 'Рейтинг юзеров';
require_once ('system/connect.php');
require_once ('system/core.php');
require_once ('system/function.php');
require_once ('str/head.php');
$all = mysql_num_rows(mysql_query("SELECT * FROM `".$prefix."users` WHERE `out` > '0' AND `in` > '0'"));
echo '<div class="topik">Переходы <b>['.$all.']</b> | <a href="/kredrat.php">Кредиты</a> | <a href="/users.php">Все</a></div>';

if($all != 0){
$total=intval(($all-1)/$page_top)+1;
$page=abs(intval($_GET['page']));
if(empty($page) OR $page < 0){
$page = 1;
}
if($page > $total){
$page = $total;
}
$past=intval($all/$page_top);
$start=$page*$page_top-$page_top;
$top = mysql_query("SELECT * FROM `".$prefix."users` WHERE `in` > '0' AND `out` > '0' ORDER BY `out` DESC LIMIT ".$start.",".$page_top."");

while($row = mysql_fetch_array($top)){
$start++;
echo '<div class="topni">'.$start.'. <a href="/str/info.php?id='.$row['id'].'">'.$row['login'].'</a> [out:<b>'.$row['out'].'</b>/in:<b>'.$row['in'].'</b>]</div>'; 
}
navigation($all,$page_top,$page,'rating.php?',$total);
echo '<div class="faz"><b><< <a href="/str/office.php">В кабинет</a></b></div>';
}
else
{
echo '<div class="stat">Юзеров нет</div>';
}
require_once ('str/foot.php');
?>