Просмотр файла top.php

Размер файла: 1.35Kb
<?
session_start(); //инициализирум механизм сесссий
include('include/stat.php');
if (!isset($_SESSION['id']))
{
header ("location: logout.php");
exit('incorrect');
}
include('include/sys.php');
include('include/game.php');
include('include/head.php');
include('include/menu.php');
echo'<div class="in">Топ игроков</div>';
$p = def($_GET['p']);
if (empty($p))
{
$p=1;
}
$off = ($p-1)*10;
function pages ($p){
$res = count_query("select count(*) from user");
$row = mysql_result($res,0);
$b   = ceil(($row/10))  ;
$x   = 1;
while ($b>=$x)
{
if ($x==$p)
{
$pages .= ' ['.$x.'] ';
}
else
{
$pages .= ' <a href="?top.php&p='.$x.'">'.$x.'</a> ';
}
$x++;
}
return $pages;
}

$cont = count_query("SELECT *
FROM user
ORDER BY user.exp DESC LIMIT $off,10");
echo '<div class="link">Н,Раса,Имя,Ур.,Доб.,Жертвы,Поб/Пор.,Золото</div>';
while ($cont1 = mysql_fetch_assoc($cont)){
$off++;
if ($cont1['race']==1)
{
$name_race='Вампир';
}
else
{
$name_race='Оборотень';
}
print"	<div class='link'>".$off.".".$name_race." ><a href=pers.php?id=".$cont1['id']." title=".$cont1['name'].">".$cont1['name']." [".$cont1['id']."] </a> ".lvl($cont1['exp'])." ".$cont1['stat_prey']." ".$cont1['stat_victim']." ".$cont1['stat_win']."/".$cont1['stat_loss']." ".$cont1['stat_gold_p']."</div>";
}
echo pages($p);

include 'include/foot.php';?>