<?php
include_once("incs/conf.php");
include_once("incs/fmysql.php");
include_once("incs/fnc.php");
include_once("incs/head.php");

head("Онлайн",$meuser,$auth);
echo "<div class='rowup'>";
include_once("incs/title.php");
echo "Онлайн</div>";

$k_online=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `date_last` > '".($time-600)."'"), 0);
if ($k_online==0)
{
echo "Сейчас на сайте никого нет<br>";
}

if($on==1){
$end=$user[msg_for_page];
}else{
$end=10;}
$skok_pages=ceil($k_online/$end);
if(!isset($_GET['page'])){
$page=1;
}else{
$page=intval($_GET['page']);
if($page<1){$page=1;}
if($page>$skok_pages){$page=1;}
}
if($page==1 OR $page<1){
$start=0;
}else{
$start=($page-1)*$end;
}

$user_online = mysql_query("SELECT * FROM `user` WHERE `date_last` > '".($time-600)."' ORDER BY `date_last` DESC LIMIT $start, $end");
while ($online_us = mysql_fetch_array($user_online))
{
$sek=$time-$online_us[date_last];
if($num==1){ 
echo "<div class='reki'>"; 
$num=0;
}else{ 
echo "<div class='rek'>"; 
$num=1;}
echo "<a href='id$online_us[id]'>".(file_exists("avatar/".$online_us['id'].$online_us['avatar']) ? "<img src='avatar/".$online_us['id'].$online_us['avatar']."' width='48' height='60' alt='ava' border='0'/>" : "")."</a>";

if($online_us[pol]==0){echo "<img src=\"img/0.png\" alt=\"image\"/>";}
if($online_us[pol]==1){echo "<img src=\"img/1.png\" alt=\"image\"/>";}
echo " <a href='my.php?id=$online_us[id]'>$online_us[nick]</a> ";
if($online_us[level]>=2){echo "<img src=\"img/admin.gif\" alt=\"image\"/>";}

echo "</div>";
}
if($skok_pages>1){
for($i=1;$i<=$skok_pages;$i++){
if($i==$page){
echo "<span class=\"str_t\">$i</span>";
}else{
echo "<span class=\"str_l\"><a href='?page=$i'>$i</a></span>";
}}}
include_once("incs/down.php");
?>