<?php
require_once '../core/system.php';
echo only_reg();
$header = 'Рейтинг игроков';
require_once '../core/head.php';
$k_post = mysql_result(mysql_query("SELECT COUNT(*)  FROM `user` where `param` > '0'"),0);
$p= mysql_query("SELECT * FROM `user` ORDER BY `param` DESC LIMIT 1");
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str']*$page-$set['p_str'];


$q = mysql_query("SELECT * FROM `user` where `param` > '0' ORDER BY `param` DESC LIMIT $start, $set[p_str]");
echo "<div class='block_zero'>";
while($post2 = mysql_fetch_assoc($p)) {
echo "<div class='dgreen bold'><img src='/images/icon/crys/1.png'> Самый сильный</div><div class='float-left'><a href='/user/$post2[id]/'><img src='/style/avatar/".($post2['pol'] == 0 ? "zj" : "m")."/$post2[avatar].png' width='130' height='180' style='margin-right:10px;margin-top:3px;' alt=''/></a></div>";
if ($post2['storona'] == '0') {?><img src="/images/icon/0.png"  height="11" alt="a"/> <?php }
	    if ($post2['storona'] == '1') {?><img src="/images/icon/1.png"  height="11" alt="d"/> <?php }
echo online($post2[id]);
echo " $post2[nick]<br/><br/><img src='/images/icon/str.png' alt='str'/> Сила: $post2[sila]<br/><img src='/images/icon/vit.png' alt='vit'/> Здоровье: $post2[max_health]<br/><img src='/images/icon/agi.png' alt='agi'/> Ловкость: $post2[lovk]<br/><img src='/images/icon/def.png' alt='def'/> Защита: $post2[zashit]<br/><div style='clear:both;'></div>";
}
while($post = mysql_fetch_assoc($q)) {
if ($post['storona'] == '0') {?><img src="/images/icon/0.png"  height="11" alt="a"/> <?php }
	    if ($post['storona'] == '1') {?><img src="/images/icon/1.png"  height="11" alt="d"/> <?php }
echo online($post[id]);
$pets_param = $post[silapets] + $post[vinoslpets] + $post[healthpets];
$post[param] = $post[param] + $pets_param;
echo ' <a href="/user/'.$post['id'].'/">'.$post['nick'].'</a> <img src="/images/icon/level.png"> '.$post['level'].', '.$post[param].'<br />';
}
if ($k_page>1){
str('?',$k_page,$page);
}
echo "</div>";
echo "<div class='mini-line'></div>";
echo "<div class='menuList'>";
echo "<li><a href='sumstat'><img src='/images/icon/str.png'><span class='grey'>По сумме параметров</span></a></li>";
echo "<li><a href='duel'><img src='/images/icon/sumstat.png'>Дуэли</a></li>";
echo "</div>";
echo "<div class='mini-line'></div>";
echo "<ul class='hint'><li>Рейтинг обновляется один раз в 10 минут</li></ul>";
echo "</div>";
require_once '../core/foot.php';
?>