<?
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';
include_once 'sys/inc/user.php';

$set['title']='Сейчас на сайте'; // заголовок страницы
include_once 'sys/inc/thead.php';
title();
aut();
	/*==============================================Этот скрипт выводит 1 случайного "Лидера" и ссылку на весь их список.(с) DCMS-Social==============================================*/	$k_lider = mysql_result(mysql_query("SELECT COUNT(*) FROM `liders` WHERE `time` > '$time'"),0);$liders = mysql_fetch_assoc(mysql_query("SELECT * FROM `liders` WHERE `time` > '$time' ORDER BY rand() LIMIT 1"));if ($k_lider > 0){	echo '<div class="main">';		$lider = get_user($liders['id_user']);		echo status($lider['id']);	echo group($lider['id']) , ' <a href="/info.php?id=' . $lider['id'] . '">' . $lider['nick'] . '</a> ';	echo medal($lider['id']) , online($lider['id']) , '<br />';		if ($liders['msg'])echo output_text($liders['msg']) . '<br />';	echo '<img src="/style/icons/lider.gif" alt="S"/> <a href="/user/liders/">Все лидеры</a> (' . $k_lider . ')';		echo '</div>';}
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `date_last` > '".(time()-600)."'"), 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()-600)."' ORDER BY `date_last` DESC LIMIT $start, $set[p_str]");
echo "<table class='post'>\n";
if ($k_post==0){echo "  <div class='main'>\n";echo "Сейчас на сайте никого нет\n";echo "  </div>\n";}

while ($ank = mysql_fetch_assoc($q))
{
	$ank=get_user($ank['id']);$ank['ank_age']=null;
		if ($ank['ank_d_r']!=NULL && $ank['ank_m_r']!=NULL && $ank['ank_g_r']!=NULL){
	$ank['ank_age']=date("Y")-$ank['ank_g_r'];
		if (date("n")<$ank['ank_m_r'])$ank['ank_age']=$ank['ank_age']-1;
	elseif (date("n")==$ank['ank_m_r']&& date("j")<$ank['ank_d_r'])$ank['ank_age']=$ank['ank_age']-1;
}
/*-----------зебра-----------*/
if ($num==0){
	echo "  <div class='nav1'>\n";
	$num=1;
}elseif ($num==1){
	echo "  <div class='nav2'>\n";
	$num=0;
}
/*---------------------------*/

if ($set['set_show_icon']==2){
	avatar($ank['id']);
}
elseif ($set['set_show_icon']==1)
{
	echo "".status($ank['id'])."";
}


echo group($ank['id'])." <a href='/info.php?id=$ank[id]'>$ank[nick]</a>\n";
echo '<b>('.(($ank['pol']==1)?'М':'Ж').(($ank['ank_age']==null)?'/Не указан':'/'.$ank['ank_age']).')</b>';
if ($ank['ank_city']!=NULL)
echo ", ".htmlspecialchars($ank['ank_city'])."\n";
echo "".medal($ank['id'])." ".online($ank['id'])." <br />";
if ($ank['ank_o_sebe']!=NULL)
echo "".htmlspecialchars($ank['ank_o_sebe'])."\n";




if (user_access('user_collisions') && $user['level']>$ank['level'])
{
$mass[0]=$ank['id'];
$collisions=user_collision($mass);


if (count($collisions)>1)
{
echo "<span class=\"ank_n\">Возможные ники:</span>\n";
echo "<span class=\"ank_d\">\n";

for ($i=1;$i<count($collisions);$i++)
{
$ank_coll=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '$collisions[$i]' LIMIT 1"));
echo "\"<a href='/info.php?id=$ank_coll[id]'>$ank_coll[nick]</a>\"\n";
}

echo "</span>\n";

}
}


echo '</div>';

}

echo "</table>\n";


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




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