<?
include_once 'sys/inc/start.php';
include_once 'sys/inc/compress.php';
include_once 'sys/inc/sess.php';
include_once 'sys/inc/home.php';
include_once 'sys/inc/settings.php';
include_once 'sys/inc/db_connect.php';
include_once 'sys/inc/ipua.php';
include_once 'sys/inc/fnc.php';
$show_all=true; // показ для всех
include_once 'sys/inc/user.php';

$set['title']='В хате сейчас'; // заголовок страницы
include_once 'sys/inc/thead.php';
title();

$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `date_last` > '".(time()-1500)."'"), 0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q = mysql_query("SELECT `id` FROM `user` WHERE `date_last` > '".(time()-1500)."' ORDER BY `date_last` DESC LIMIT $start, $set[p_str]");
echo "<table class='post'>\n";
if ($k_post==0)
{

echo "Сейчас на сайте никого нет\n";

}
while ($ank = mysql_fetch_array($q))
{
$ank=get_user($ank['id']);

echo "<table class='post'>\n";
if ($user['show_online']==0)
{
if ($ank['show_secret']==1)
{
echo '<tr><td class="icon14">';
echo "<img src='/style/secret.png' alt='' class='icon' width='24' height='32'/>\n";
echo '<td class="anput">';
echo "".online($ank['id'])." <font color='red'>Невидимка</sont>\n";
if (user_access('adm_news'))echo " (<a href='/info.php?id=$ank[id]'><span style='color:$ank[ncolor]'>$ank[nick]</span></a>)\n";
echo "<br/>\n";
echo "<font color='#afb0a3'>(Скрытый профиль)</sont>\n";

echo "  </td>\n";
echo "   </tr>\n";
}

if ($ank['show_secret']==0)
{
echo '<tr><td class="icon14">';
echo " <a href='/foto/$ank[id]/'>\n";
avatar3($ank['id']);
echo "</a>\n";
echo '<td class="anput">';
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ban` WHERE `id_user` = '$ank[id]' AND `time` > '$time'"), 0)!=0)
echo "<font color='red'>[BAN]</font>\n";

if ($ank['pobeda']!=NULL)echo "<img src='/style/icons/pobeditel.png' alt='' class='icon'/>\n";
echo "".online($ank['id'])." <a href='/info.php?id=$ank[id]'><span style=\"color:$ank[ncolor]\">$ank[nick]</span></a>\n";
echo "".(($ank['mobile'])?'<img src="/img/Mobile.png">':'<img src="/img/computer.png">')."\n";
if ($ank['priz']>1)echo "<img src='/style/back.gif'>\n";
if($ank['rating']>=0 && $ank['rating']<=99)echo " ";
if($ank['rating']>=100 && $ank['rating']<=199)echo " <img src='/style/rating/bronze.gif'></img> "; 
if($ank['rating']>=200 && $ank['rating']<=299)echo " <img src='/style/rating/silver.gif'></img> ";
if($ank['rating']>=300 && $ank['rating']<=399)echo " <img src='/style/rating/gold.gif'></img> ";
if($ank['rating']>=400 && $ank['rating']<=1000)echo " <img src='/style/rating/lafes_user.gif'></img> ";
if($ank['rating']>=1001 && $ank['rating']<=10000)echo " <img src='/rating/konkurs.png'></img> ";
if ($ank['brak']!=NULL)echo "<img src='/style/icons/rings.gif' alt='' class='icon'/> \n";
if ($ank['braks']!=NULL)echo "<img src='/style/icons/rings.gif' alt='' class='icon'/> \n";
if ($ank['stran']==0)echo "\n";
if ($ank['stran']==1)echo "<img src='/style/strana/ru.png'>\n";
if ($ank['stran']==2)echo "<img src='/style/strana/ua.png'>\n";
if ($ank['stran']==3)echo "<img src='/style/strana/by.png'>\n";
if ($ank['stran']==4)echo "<img src='/style/strana/az.png'>\n";
if ($ank['stran']==5)echo "<img src='/style/strana/kz.png'>\n";
if ($ank['stran']==6)echo "<img src='/style/strana/uz.png'>\n";
if ($ank['stran']==7)echo "<img src='/style/strana/england.png'>\n";
if ($ank['stran']==8)echo "<img src='/style/strana/de.png'>\n";
if (isset($user) && $user['id']==$ank['id']){echo " (Это Вы)<br/>\n";}
if (isset($user) && $user['id']!=$ank['id'])echo " <a href='/mail.php?id=$ank[id]'><img src='/img/mail.gif' alt='' /></a> <br/>\n";
if($ank['rating']>=0 && $ank['rating']<=25)echo "<img src='/style/stat.png'> <font color='red'>Новичок </font></img> ";
if($ank['rating']>=26 && $ank['rating']<=50)echo "<img src='/style/stat.png'> <font color='red'>Продвинутый </font></img> ";
if($ank['rating']>=51 && $ank['rating']<=75)echo "<img src='/style/stat.png'> <font color='red'>Бывалый </font></img> ";
if($ank['rating']>=76 && $ank['rating']<=110)echo "<img src='/style/stat.png'> <font color='red'>МегаОбитатель </font></img> ";
if($ank['rating']>=111 && $ank['rating']<=149)echo "<img src='/style/stat.png'> <font color='red'>Ветеран </font></img> ";
if($ank['rating']>=150 && $ank['rating']<=199)echo "<img src='/style/stat.png'> <font color='red'>Почетный Юзер </font></img> ";
if($ank['rating']>=200 && $ank['rating']<=1120)echo "<img src='/style/stat.png'> <font color='red'>Лидер </font></img> ";
if ($ank['show_url']==0)
{
    	if (otkuda($ank['url'])){echo " <font color='#afb0a3'>(".otkuda($ank['url']).")</font><br />\n";
}else{echo "<font color='#afb0a3'>(На сайте)</font><br />\n";}
		}
}}
echo "  </table>\n";
}

if ($k_page>1)str("?",$k_page,$page); // Вывод страниц

echo "<div class='listing'>";
echo "<center>Сейчас онлайн <font color='red'>".mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `date_last` > ".(time()-1500).""), 0)."</font> обитателя</a> + \n";
echo "<a href='/online_g.php'>".mysql_result(mysql_query("SELECT COUNT(*) FROM `guests` WHERE `date_last` > ".(time()-1500)." AND `pereh` > '0'"), 0)."</a> гостей</center></div> \n";
echo "<div class='listing'><center>";
echo "На сайте были: <a href='/2days.php'>за последние 2-е суток</a> | <a href='/7days.php'>неделю</a>\n";
echo "</center></div>\n";


include_once 'sys/inc/tfoot.php';
?>