<?
include_once "SYSTEM/include/functions.php";
include_once "SYSTEM/include/mysql.php";
include_once "SYSTEM/include/param.php";
include_once "SYSTEM/include/ban.php";
include_once "SYSTEM/include/sess.php";
include_once "SYSTEM/include/ban_2.php";
include_once "SYSTEM/include/theme.php";
$mesto='Кто-где';
$title='Кто-где';
head();
echo "<div class=\"h\">Кто - где?</div><hr />\n";
if ($mail_in_new>0)echo "<div class=\"privat\"><img src=\"SYSTEM/themes/$them/img/mail0.gif\" alt=\"\" /> <a href=\"mail.php?act=in\">Приват</a> [$mail_in_new]</div><hr />\n";


if (isset($user))
{
$k_p_str=$user['k_page'];
}
else
{
$k_p_str=$set['k_p_s'];
}
if (($onl['on_guest']-$onl['on_users'])!="0")
{
$v_pages_okr=($onl['on_guest']-$onl['on_users'])/$k_p_str%100;
$v_pages_tochn=($onl['on_guest']-$onl['on_users'])/$k_p_str;
if ($v_pages_okr==$v_pages_tochn)
{
$k_page=$v_pages_okr;
}
else
{
$k_page=$v_pages_okr+1;
}
}
$page=1;

if (($onl['on_guest']-$onl['on_users'])>0){
if (isset($_GET['page']) && intval($_GET['page'])>0)
{
$page=intval($_GET['page']);
}
elseif (isset($_GET['page']) && $_GET['page']=='end')
{
$page=$k_page;
}

if ($k_page<$page){$page=$k_page;}
if (0>$page){$page=1;}
$i=$k_p_str*$page-$k_p_str;

$q = mysql_query("SELECT * FROM `$mysql[pref]online` ORDER BY last_time DESC LIMIT $i, $k_p_str;");
while ($who = mysql_fetch_array($q))
{



$q2 = mysql_query("SELECT * FROM `$mysql[pref]users` WHERE `sess` = '$who[sess]' LIMIT 1;");
$post_user = mysql_fetch_array($q2, 1);
if ($post_user['time']>time()-$set['time_sess'] && $post_user['sess']!='')
{
// Показ зарегистрированих юзеров

$stat='';
if ($post_user['level']==1){$stat=" <span style=\"color:$color[level]\">mod</span>";}
if ($post_user['level']==2){$stat=" <span style=\"color:$color[level]\">smd</span>";}
if ($post_user['level']==3){$stat=" <span style=\"color:$color[level]\">adm</span>";}
if ($post_user['level']==4){$stat=" <span style=\"color:$color[level]\">adm</span>";}

if ($post_user['time']>time()-$set['time_sess'] && $post_user['sess']!=''){
$on="<span style=\"color:$color[on]\">on</span>";}
else{$on="<span style=\"color:$color[off]\">off</span>";}


//echo "<div class=\"post_title\">Я <font color=\"#FFA500\">на</font> сайте<br /></div><table><tr><td><img src=\"".BASEDIR."SYSTEM/themes/$them/img/menu/4.gif\" alt=\"\" /></td><td>\n";
echo "<img src=\"SYSTEM/themes/$them/img/forum/pol_$post_user[pol].gif\" alt=\"\" />";
echo " <a href=\"info.php?id=$post_user[id]\"><span style=\"color:$color[mess_nick]\"><b>$post_user[nickname]</b></span></a>$stat $on";
if ($post_user['time']<$time-$set['time_sess'] || $post_user['sess']=='')
{
echo "<br/>\n<span style=\"color:$color[post_time]\">".vremja($post_user['time']+$timesdvig)."</span>";
}
echo "<br />\n";
if ($post_user['url']!='' && $post_user['mesto']!='')
{
echo "Место: <a href=\"$post_user[url]\">$post_user[mesto]</a>";
}
if ($post_user['time']>time()-$set['time_sess'] && $post_user['sess']!=''){echo "<br/>\nПереходов: $who[pereh]";}

//echo "</div>\n";
echo "<br />\n";
echo '</td></tr></table>';
}
else
{
echo "<div class=\"mess\">\n";
echo "<img src=\"SYSTEM/themes/$them/img/user/pol_.gif\" alt=\"\" />";
echo " <span style=\"color:$color[mess_nick]\"><b>Гость</b></span>";
if ($who['url']!='' && $who['mesto']!='')
echo "<br/>\nМесто: <a href=\"$who[url]\">$who[mesto]</a>";
echo "<br/>\nПереходов: $who[pereh]";

if ($who['referrer']!='')
echo "<br />\nОткуда: <a href=\"$who[referrer]\">$who[referrer]</a>";
else
echo "<br />\nОткуда: неизвестно";

echo "<br />$who[ua] | $who[ip]";
echo "</div>\n";
echo "<br />\n";
}





}
echo "<hr />\n<div class=\"str\">";
str("who_all.php?",$k_page,$page);
echo "</div>\n";
}
else
{
echo "Нет гостей<br/>\n";
}




echo "<hr />\n";
echo "<a href=\"who.php?page=$page\">Скрыть гостей</a><br/>\n";
echo "<a href=\"index.php\">На главную</a><br/>\n";
foot();
?>
