<?php
require_once 'core/sys.php';
include 'core/func_online.php';
head('Игроки');
$sort_arr = array('time','reg_time','level','money','win');
$sorts=$sort_arr[0];
if(isset($_GET['sorts'])){
$sorts = protect($_GET['sorts']);
}
if(!in_array($sorts,$sort_arr) OR !isset($_GET['sorts'])){
$sorts=$sort_arr[0];
}
$users_q = mysql_query("SELECT * FROM `users` ORDER BY `".$sorts."` DESC LIMIT ".$page.",".$set['str']."");
$total = mysql_num_rows(mysql_query("SELECT `id` FROM `users`"));
$count_online = mysql_num_rows(mysql_query("SELECT (id) FROM `users` WHERE `time`+600 >'".time()."'"));
if($total==0){
echo '<div id="error">Нет ни одного пользователя</div>';
foot();
exit;
}
echo '<div class="name">
<form action="all_us.php" method="get">
Сортировать по: 
<select name="sorts">
<option value="time">Онлайн</option>
<option value="reg_time">Дате регистрации</option>
<option value="level">Уровню</option>
<option value="money">Деньгам</option>
<option value="win">Победам</option>
</select>
<input type="submit" value="ok">
</form></div>';
while($row_us = mysql_fetch_assoc($users_q)){
$nick = '<a href="pers.php?ank='.$row_us['id'].'">'.$row_us['login'].'</a>';
			if($row_us['admins']>0){
	
			$nick = '<a href="pers.php?ank='.$row_us['id'].'"><span style="color: #0f7b8c; font-weight: bold;text-shadow: 1px 0 8px #0f7b8c;">'.$row_us['login'].'</span></a>';
			}
echo '<div class="row"><b>'.$nick.'</b> '.online($row_us['id']).' [ур. '.$row_us['level'].']<br>
<img src="img/money/money.png" alt=""> '.$row_us['money'].' <img src="img/money/rubin.png" alt=""> '.$row_us['rubin'].'<br>
Побед на арене: '.$row_us['win'].'<br>
Дата регистрации: '.clock($row_us['reg_time']).'<br>

</div>';
}
echo '<div class="name">Игроков: '.$total.'<br>
<font color="green">Онлайн: '.$count_online.'</font></div>';
    if($total > $set['str'])
	{
		pages($page, $total, 'all_us.php?sorts='.$sorts.'&amp;', $set['str']);
	}
foot();
?>