<?php
include 'system/bd.php';
include 'system/cook.php';
include ("system/gzip.php");
if(isset($_SESSION['auth']) && $_SESSION['auth']==1){
include 'system/head.php';
switch($_GET[mod]){
default:

echo '<div class="title">Онлайн</div>';

$qr=mysql_query("SELECT COUNT(*) FROM `user` WHERE '".time()."' - `online` < '7000'");
$cop=10;

$ca=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE '".time()."' - `online` < '7000' "),0);

$cp=ceil($ca/$cop);
if(isset($_GET['page']) && is_numeric($_GET['page'])){
$page = $_GET['page'];
if($_GET['page']>$cp) $page=$cp;
if($_GET['page']<1)$page=1;
}else{
$page=1;
}
$start=$page*$cop-$cop;
$dlist = 'list1';

	

$q=mysql_query("SELECT * FROM `user` WHERE '".time()."' - `online` < '7000' ORDER by `exp` DESC LIMIT $start,$cop");
while

 ($result=mysql_fetch_assoc($q)){


if($result){

echo '<div class="block_link"><a href="users.php?id='.$result['id'].'">';

$d = time()-7000;
if($us[online] >$d) { 
echo"<img src='img/user/icons/".$result[storona]."_".$result[rasa]."_off.png'>"; 
}else{
echo"<img src='img/user/icons/".$result[storona]."_".$result[rasa].".png'>";
}

echo"<img src='img/user/icons/".$result[storona]."_".$result[rasa]."_".$result[online]<$d.".png'>";

echo ' '.htmlspecialchars(stripslashes($result['login'])).'<img src="/img/icon/lvl.png" alt="*"/> '.$result['lvl'].' ';

if($result[prava] == '3' ){
echo "<font color='orange'> [Админ] </font> ";}
if($result[prava] == '2' ){
echo "<font color='lime'> [Модератор] </font> ";}
if($result[prava] == '1' ){
echo "<font color='yellow'> [Консультант] </font> ";}

echo ' </a> </div> <div class="line"></div>';
}
}
echo '
<div class="empty_block top pagi item_center">';

if($page-1>0){

echo '<a href="?page='.($page-1).'">&lt;</a> ';

}

if($page-1>0){

echo '<a href="?page='.($page-1).'">'.($page-1).'</a> ';

}

echo '<b>'.$page.'</b>';

if($page+1<=$cp){

echo ' <a href="?page='.($page+1).'">'.($page+1).'</a>';

}

if($page+1<=$cp){

echo ' <a href="?page='.($page+1).'">&gt;</a>';

}
echo '</div>';

echo ' <div class="block_link">
 <table width="100%" border="0" cellpadding="0" cellspacing="0" style="color:#E5CBB7">
<tbody>
<tr>
<td align="center" width="50%"><a href="?">
Все</a></td> 

<td align="center"><a href="?mod=no_clan">Без клана</a>
</td></tr></tbody></table></div>';


echo'<div class="block_link">';
echo" <a href=\"search.php\"><img src='img/images/arrow.png' alt='*'/> Поиск игроков</a></div>";

break;

case'no_clan':

echo '<div class="title">Онлайн без клана </div>';
$qr=mysql_query("SELECT COUNT(*) FROM `user` WHERE '".time()."' - `online` < '7000' and `clan`='0' ");
$cop=10;

$ca=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE '".time()."' - `online` < '7000' and `clan`='0' "),0);

$cp=ceil($ca/$cop);
if(isset($_GET['page']) && is_numeric($_GET['page'])){
$page = $_GET['page'];
if($_GET['page']>$cp) $page=$cp;
if($_GET['page']<1)$page=1;
}else{
$page=1;
}
$start=$page*$cop-$cop;
$dlist = 'list1';

	

$q=mysql_query("SELECT * FROM `user` WHERE '".time()."' - `online` < '7000' and `clan`='0' ORDER by `exp` DESC LIMIT $start,$cop");
while

 ($result=mysql_fetch_assoc($q)){


if($result){

echo '<div class="block_link"><a href="users.php?id='.$result['id'].'">';

$d = time()-7000;
if($us[online] >$d) { 
echo"<img src='img/user/icons/".$result[storona]."_".$result[rasa]."_off.png'>"; 
}else{
echo"<img src='img/user/icons/".$result[storona]."_".$result[rasa].".png'>";
}

echo"<img src='img/user/icons/".$result[storona]."_".$result[rasa]."_".$result[online]<$d.".png'>";

echo ' '.htmlspecialchars(stripslashes($result['login'])).'<img src="/img/icon/lvl.png" alt="*"/> '.$result['lvl'].' ';

if($result[prava] == '3' ){
echo "<font color='orange'> [Админ] </font> ";}
if($result[prava] == '2' ){
echo "<font color='lime'> [Модератор] </font> ";}
if($result[prava] == '1' ){
echo "<font color='yellow'> [Консультант] </font> ";}

echo ' </a> </div> <div class="line"></div>';
}
}
echo '
<div class="empty_block top pagi item_center">';
 if($page-1>0){

echo '<a href="online.php?mod=no_clan&page='.($page-1).'">&lt;</a> ';

}

if($page-1>0){

echo '<a href="online.php?mod=no_clan&page='.($page-1).'">'.($page-1).'</a> ';

}

echo '<b>'.$page.'</b>';

if($page+1<=$cp){

echo ' <a href="online.php?mod=no_clan&page='.($page+1).'">'.($page+1).'</a>';

}

if($page+1<=$cp){

echo ' <a href="online.php?mod=no_clan&page='.($page+1).'">&gt;</a>';

}
echo '</div>';

echo ' <div class="block_link">
 <table width="100%" border="0" cellpadding="0" cellspacing="0" style="color:#E5CBB7">
<tbody>
<tr>
<td align="center" width="50%"><a href="online.php">
Игроки</a></td> 

<td align="center"><a href="?mod=no_clan">Без клана</a>
</td></tr></tbody></table></div>';

echo'<div class="block_link">';
echo" <a href=\"search.php\"><img src='img/images/arrow.png' alt='*'/> Поиск игроков</a></div>";


}
}else{
header ("Location: index.php"); exit;
}
include 'system/foot.php';
?>
