<?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 `kr` > '0'"));
echo '<div class="topik"><a href="rating.php">Переходы</a> | Кредиты <b>['.$all.']</b> | <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 `kr` > '0' ORDER BY `kr` 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> <b>['.$row['kr'].']</b> .Кр</div>'; 
}
 navigation($all,$page_top,$page,'kredrat.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');
?>