Файл: Gladiators v2.2/modules/ratings/index.asp
Строк: 51
<?php
/**
* @author ByUNNAMED
* @copyright 2012
*/
ob_start();
$title='Город';//Титул
include('../../system/include/settings.inc');//Потключаемся к базе
include('../../system/include/function.inc');//Выводим функции
head($title,$udata2);//Верх страницы
if(isset($udata['pass']) && isset($udata2['nick'])){
switch($_GET['mod'])
{
default:
echo '<a href="?mod=exp">Самые опитные</a><br />';
echo '<a href="?mod=arena">Герои арены</a><br />';
echo '<a href="?mod=clan">Рейтинг кланов</a><br />';
break;
case 'exp':
$at_page=6;
$page = (int)$_GET['page'];
$s=mysql_result(mysql_query("SELECT COUNT(`id`) FROM `chars`"),0);
$total = intval(($s - 1) / $at_page) + 1;
$page = (int)$page;
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$from = $page * $at_page - $at_page;
$req = mysql_query("SELECT * FROM `chars` ORDER BY `exp` DESC LIMIT ".$from.",".$at_page."");
$i = 1;
while($r = mysql_fetch_array($req))
{
echo $i.'. <a href="../../modules/character/info.asp?nick='.$r['nick'].'">'.$r['nick'].' </a>[Уровень: '.$r['lvl'].']<br />';
$i++;
}
if($s > 1)
{
if($s > $onpage) echo '';
if ($page >= 4) $go1 = '<a href= ?page=1>1</a> ... ';
if ($page != $total and $page != $total-1) $outpage = ' ... <a href= ?page=' .$total. '>'.$total.'</a>';
if($page - 2 > 0) $page2left = ' <a href= ?page='. ($page - 2) .'>'. ($page - 2) .'</a> ';
if($page - 1 > 0) $page1left = '<a href= ?page='. ($page - 1) .'>'. ($page - 1) .'</a> ';
if($page + 2 <= $total) $page2right = ' <a href= ?page='. ($page + 2) .'>'. ($page + 2) .'</a>';
if($page + 1 <= $total) $page1right = ' <a href= ?page='. ($page + 1) .'&>'. ($page + 1) .'</a>';
if($s > $onpage) echo 'Страницы: ('.$go1.''.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.''.$outpage.')<br/>';
}
break;
case 'arena':
$at_page=6;
$page = (int)$_GET['page'];
$s=mysql_result(mysql_query("SELECT COUNT(`id`) FROM `chars`"),0);
$total = intval(($s - 1) / $at_page) + 1;
$page = (int)$page;
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$from = $page * $at_page - $at_page;
$req = mysql_query("SELECT * FROM `chars` ORDER BY `arena_win` DESC LIMIT ".$from.",".$at_page."");
$i = 1;
while($r = mysql_fetch_array($req))
{
echo $i.'. <a href="../../modules/character/info.asp?nick='.$r['nick'].'">'.$r['nick'].' </a>[Побед: '.$r['arena_win'].']<br />';
$i++;
}
if($s > 1)
{
if($s > $onpage) echo '';
if ($page >= 4) $go1 = '<a href= ?page=1>1</a> ... ';
if ($page != $total and $page != $total-1) $outpage = ' ... <a href= ?page=' .$total. '>'.$total.'</a>';
if($page - 2 > 0) $page2left = ' <a href= ?page='. ($page - 2) .'>'. ($page - 2) .'</a> ';
if($page - 1 > 0) $page1left = '<a href= ?page='. ($page - 1) .'>'. ($page - 1) .'</a> ';
if($page + 2 <= $total) $page2right = ' <a href= ?page='. ($page + 2) .'>'. ($page + 2) .'</a>';
if($page + 1 <= $total) $page1right = ' <a href= ?page='. ($page + 1) .'&>'. ($page + 1) .'</a>';
if($s > $onpage) echo 'Страницы: ('.$go1.''.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.''.$outpage.')<br/>';
}
break;
case 'clan':
$at_page=6;
$page = (int)$_GET['page'];
$s=mysql_result(mysql_query("SELECT COUNT(`id`) FROM `clan`"),0);
$total = intval(($s - 1) / $at_page) + 1;
$page = (int)$page;
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$from = $page * $at_page - $at_page;
$req = mysql_query("SELECT * FROM `clan` ORDER BY `gold` DESC LIMIT ".$from.",".$at_page."");
$i = 1;
while($r = mysql_fetch_array($req))
{
echo $s.'. <a href="../../modules/clan/info.asp?id='.$r['id'].'">'.$r['name'].' </a><br />';
$i++;
}
if($s > 1)
{
if($s > $onpage) echo '';
if ($page >= 4) $go1 = '<a href= ?page=1>1</a> ... ';
if ($page != $total and $page != $total-1) $outpage = ' ... <a href= ?page=' .$total. '>'.$total.'</a>';
if($page - 2 > 0) $page2left = ' <a href= ?page='. ($page - 2) .'>'. ($page - 2) .'</a> ';
if($page - 1 > 0) $page1left = '<a href= ?page='. ($page - 1) .'>'. ($page - 1) .'</a> ';
if($page + 2 <= $total) $page2right = ' <a href= ?page='. ($page + 2) .'>'. ($page + 2) .'</a>';
if($page + 1 <= $total) $page1right = ' <a href= ?page='. ($page + 1) .'&>'. ($page + 1) .'</a>';
if($s > $onpage) echo 'Страницы: ('.$go1.''.$page2left.$page1left.'<b>'.$page.'</b>'.$page1right.$page2right.''.$outpage.')<br/>';
}
break;
}
}else{echo'Вы не ';
echo '<a href="../../index.asp">авторизированы</a> или не выбран персонаж';
}
foot();
?>