<?php
include_once('../inclfiles/core.php');
$title = 'Пользователи';
include_once('../inclfiles/head.php');
$all = mysql_num_rows(mysql_query("SELECT * FROM `users`"));
if($all != 0){
	$total=intval(($all-1)/$set['napage'])+1;
	if(empty($page) OR $page < 0) $page = 1;
	if($page > $total) $page = $total;
	$past=intval($all/$set['napage']);
	$start=$page*$set['napage']-$set['napage'];

	echo '<div class="nav">';
	if($sort == 'status' OR $sort==null) echo 'Статус';
	else echo '<a href="users.php?sort=status&'.$gets.'">Статус</a>';
	echo ' | ';
	if($sort == 'time_online') echo 'Время онлайн';
	else echo '<a href="users.php?sort=time_online&'.$gets.'">Время онлайн</a>';
	echo ' | ';
	if($sort == 'time_reg') echo 'Новички';
	else echo '<a href="users.php?sort=time_reg&'.$gets.'">Новички</a>';
	echo '</div>';

	if($sort != 'time_online' AND $sort != 'time_reg') $sort = 'time_last';
    $users = mysql_query("SELECT * FROM `users` ORDER BY `".$sort."` DESC LIMIT ".$start.",".$set['napage']."");
	while($ank_user = mysql_fetch_array($users)){
		if($sort == 'time_online') a_user($ank_user['id'],provel($ank_user[$sort]));
		else a_user($ank_user['id'],data($ank_user[$sort]));
	}
	navigation($all,$set['napage'],$page,'users.php?sort='.$sort.'&',$total);
}
else t('Нет пользователей');
a('index.php?','Информация об игре','info');
include_once('../inclfiles/foot.php');
?>
