<?
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();

////////////////
$on=intval($_GET['on']);
///////////////
if($on == '3') {
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `ank_city` = '$user[ank_city]' AND `date_last` > '".(time()-5000)."'"), 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 `ank_city` = '$user[ank_city]' AND `date_last` > '".(time()-5000)."' ORDER BY `date_last` DESC LIMIT $start, $set[p_str]");
} else if($on == '2') {
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `pol` = '0' AND `date_last` > '".(time()-5000)."'"), 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 `pol` = '0' AND `date_last` > '".(time()-5000)."' ORDER BY `date_last` DESC LIMIT $start, $set[p_str]");
} else if($on == '1') {
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `pol` = '1' AND `date_last` > '".(time()-5000)."'"), 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 `pol` = '1' AND `date_last` > '".(time()-8000)."' ORDER BY `date_last` DESC LIMIT $start, $set[p_str]");
}else{
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `date_last` > '".(time()-5000)."'"), 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()-5000)."' ORDER BY `date_last` DESC LIMIT $start, $set[p_str]");
}


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


$q = mysql_query("select * from `user` ORDER BY `id` desc LIMIT 1;");
$post = mysql_fetch_array(mysql_query("select `nick` from `user` where `id` = '$id[0]';"));
echo "<div class='enk_div'>";
echo ' <center><img src="/style/smiles/privet.gif" alt="privet"/>  Приветствуем новичка:';
while ($post = mysql_fetch_array($q))
{

echo ' <a href="/info.php?id='.$post['id'].'">'.$post['nick'].'</a>';
}
echo "</center></div>\n";

$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="icon_enk2">';
echo "".avatar2($ank['id'])."";
echo '<td class="online1">';
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";

echo "".on($ank['id'])."\n";
echo " ".status($ank['id'])." <a href='/info.php?id=$ank[id]'><span style=\"color:$ank[ncolor]\">$ank[nick]</span></a>\n";
if ($ank['pol'] == 0){
echo ' <img src="/style/stat.png"> ';
}
if ($ank['pol'] == 1){
echo ' <img src="/style/stat.png"> ';
}
echo "".vip($ank['id'])."\n";
if($ank['balls']>=10000 && $ank['balls']<=24900){echo "<img src='style/bron.png'>\n";}
if($ank['balls']>=25000 && $ank['balls']<=49900){echo "<img src='style/silver.png'>\n";}
if($ank['balls']>=50000 && $ank['balls']<=100000000000000000){echo "<img src='style/zol.png'>\n";}
if($ank['balls']>=1000000)echo " <img src='/style/korona123.png' alt='' class='icon'</a>";
echo "".medal($ank['id'])."";
echo " ".wap_web($ank['id'])." ";



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='/style/images/pochta.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";


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