Файл: public_html/rating.php
Строк: 80
<?
include './system/common.php';
include './system/functions.php';
include './system/user.php';
if(!$user) {
header('location: /');
exit;
}
$title = 'Рейтинг игроков';
include './system/h.php';
?>
<div class='block_zero'>
<?
$sort = _string($_GET['sort']);
$max = 10;
$count = mysql_result(mysql_query('SELECT COUNT(*) FROM `users`'),0);
$pages = ceil($count/$max);
$page = _string(_num($_GET['page']));
if($page > $pages) {
$page = $pages;
}
if($page < 1) {
$page = 1;
}
$start = $page * $max - $max;
if($page == 1) {
$i = $page - 1;
}
elseif($page == 2) {
$i = ($page + 9);
}
else
{
$i = ($page * 10) - 9;
}
switch($sort) {
default:
$q = mysql_query('SELECT * FROM `users` Where `access` < "2" ORDER BY `str`+`vit`+`agi`+`def` DESC LIMIT '.$start.', '.$max.'');
break;
case 'duel':
$q = mysql_query('SELECT * FROM `users` Where `access` < "2" ORDER BY `duel_rating` DESC LIMIT '.$start.', '.$max.'');
break;
case 'coliseum':
$q = mysql_query('SELECT * FROM `users` Where `access` < "2" ORDER BY `coliseum_rating` DESC LIMIT '.$start.', '.$max.'');
break;
case 'level':
$q = mysql_query('SELECT * FROM `users` Where `access` < "2" ORDER BY `level` DESC LIMIT '.$start.', '.$max.'');
break;
}
while($row = mysql_fetch_array($q)) {
$i++;
if($i == 1) {
$w_1 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$row['id'].'" AND `id` = "'.$row['w_1'].'"');
$w_1 = mysql_fetch_array($w_1);
if(!$w_1) {
$w_1['item'] = 0;
}
$w_2 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$row['id'].'" AND `id` = "'.$row['w_2'].'"');
$w_2 = mysql_fetch_array($w_2);
if(!$w_2) {
$w_2['item'] = 0;
}
$w_3 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$row['id'].'" AND `id` = "'.$row['w_3'].'"');
$w_3 = mysql_fetch_array($w_3);
if(!$w_3) {
$w_3['item'] = 0;
}
$w_4 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$row['id'].'" AND `id` = "'.$row['w_4'].'"');
$w_4 = mysql_fetch_array($w_4);
if(!$w_4) {
$w_4['item'] = 0;
}
$w_5 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$row['id'].'" AND `id` = "'.$row['w_5'].'"');
$w_5 = mysql_fetch_array($w_5);
if(!$w_5) {
$w_5['item'] = 0;
}
$w_6 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$row['id'].'" AND `id` = "'.$row['w_6'].'"');
$w_6 = mysql_fetch_array($w_6);
if(!$w_6) {
$w_6['item'] = 0;
}
$w_7 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$row['id'].'" AND `id` = "'.$row['w_7'].'"');
$w_7 = mysql_fetch_array($w_7);
if(!$w_7) {
$w_7['item'] = 0;
}
$w_8 = mysql_query('SELECT * FROM `inv` WHERE `user` = "'.$row['id'].'" AND `id` = "'.$row['w_8'].'"');
$w_8 = mysql_fetch_array($w_8);
if(!$w_8) {
$w_8['item'] = 0;
}
$pit = mysql_query('SELECT * FROM `pit_user` WHERE `id_user` = "'.$row['id'].'"');
$pit = mysql_fetch_array($pit);
$pit = mysql_query('SELECT * FROM `pits` WHERE `id` = "'.$pit['id_pit'].'"');
$pit = mysql_fetch_array($pit);
switch($sort) {
default:
?>
<font color="#9c9"><b>Самый сильный</b></font><div class='mb10'></div>
<?
break;
case 'duel':
?>
<font color="#9c9"><b>Чемпион дуэлей</b></font><div class='mb10'></div>
<?
break;
case 'coliseum':
?>
<font color="#9c9"><b>Чемпион колизея</b></font><div class='mb10'></div>
<?
break;
}
?>
<table cellpadding='0' cellspacing='0'>
<tr>
<td><a href='/user/<?=$row['id']?>/'><img src='/manekenImage/<?=$row['bg_man']?>/<?=$row['sex']?>/<?=$w_1['item']?>/<?=$w_2['item']?>/<?=$w_3['item']?>/<?=$w_4['item']?>/<?=$w_5['item']?>/<?=$w_6['item']?>/<?=$w_7['item']?>/<?=$w_8['item']?>/?pit=<?=$pit['image']?>' alt='*'/></a>
</td>
<td valign='top' style='padding-left: 5px;'>
<img src='/images/icon/race/<?=$row['r'].($row['online'] > time() - 2000 ? '':'-off')?>.png' alt='*'/> <?=$row['login']?><br/><br/>
<img src='/images/icon/str.png' alt='*'/> Сила: <?=$row['str']?><br/>
<img src='/images/icon/vit.png' alt='*'/> Жизни: <?=$row['vit']?><br/>
<img src='/images/icon/agi.png' alt='*'/> Удача: <?=$row['agi']?><br/>
<img src='/images/icon/def.png' alt='*'/> Защита: <?=$row['def']?>
</td>
</tr></table>
<?
}
else
{
?>
<img src='/images/icon/race/<?=$row['r'].($row['online'] > time() - 2000 ? '':'-off')?>.png' alt='*'> <a href='/user/<?=$row['id']?>/'><?=$row['login']?></a>
<?
switch($sort) {
default:
?>
<b><?=($row['str']+$row['vit']+$row['agi']+$row['def'])?></b>
<?
break;
case 'duel':
?>
<b><?=$row['duel_rating']?></b>
<?
break;
case 'coliseum':
?>
<img src='/images/icon/rage.png' alt='*'/> <b><?=$row['coliseum_rating']?></b>
<?
break;
}
?>
<br/>
<?
}
}
?>
<br><center><?=pages('/rating/'.$sort.'/?');?></center><br>
</div>
<div class='mini-line'></div>
<div class='menuList'>
<li><a href='/rating/'><img src='/images/icon/str.png' alt='*'/>По сумме параметров</a></li>
<li><a href='/rating/coliseum/'><img src='/images/icon/rage.png' alt='*'/>Рейтинг колизея</a></li>
<li class='no_b'><a href='/rating/duel/'><img src='/images/icon/sumstat.png' alt='*'/>Дуэли</a></li>
<li class='no_b'><a href='/clans/'><img src='/images/icon/sumstat.png' alt='*'/>Рейтинг кланов</a></li>
</div>
<?
include './system/f.php';
?>