<?php
@session_start();
require_once $_SERVER['DOCUMENT_ROOT']."/includes/start.php";
if(isset($_SESSION['auth']) and $_SESSION['auth']==1){
echo $_up;

$mtime = time();
mysql_query("update users set rtime=$mtime where login='$usr[login]' limit 1");
mysql_query("update users set room=0 where login='$usr[login]' limit 1");

///$test='1223';
///echo '<small>'.mb_substr($test, 0, 3).'...</small><br>';

include 'calendar.php';

echo '<div class="razdel" align="center"><a href="top10.php?">Топ 10</a> | <a href="clans/?">Кланы</a> | <a href="shop/?">Магазин</a></div>';


echo '
<div class="title"><img class="pic" src="/imgs/css/1.gif" alt="" /> <b>Комнаты:</b></div>
';

$rooms = mysql_query("SELECT * FROM `rooms` ORDER BY `pos` ASC");
if(mysql_num_rows($rooms)!=0)
while($room = mysql_fetch_array($rooms)){

if($room['type']=="intim"){

echo '<a href="room.php?rm='.$room['rm'].'"><b><font color="red">'.$room['name'].'</font></b></a> ('.mysql_result(mysql_query('SELECT COUNT(*) FROM `users` WHERE `room` = "'.$room['rm'].'" and `rtime`>"'.intval( time( ) - 100 ).'"'),0).')<br>';

}elseif($room['type']==''){

echo '<div class="box1"><font color="black"><a href="room.php?rm='.$room['rm'].'"><font color="black">'.$room['name'].'</font></a> ('.mysql_result(mysql_query('SELECT COUNT(*) FROM `users` WHERE `room` = "'.$room['rm'].'" and `rtime`>"'.intval( time( ) - 100 ).'"'),0).')</font><br></div>';

}elseif($room['posts']<=$usr['posts']){

echo '<a href="room.php?rm='.$room['rm'].'">'.$room['name'].'</a> ('.mysql_result(mysql_query('SELECT COUNT(*) FROM `users` WHERE `room` = "'.$room['rm'].'" and `rtime`>"'.intval( time( ) - 100 ).'"'),0).')<br>';

}

}else{

echo 'Комнат нет пока...<br>';

}

echo '
<div class="title"><img class="pic" src="/imgs/css/2.gif" alt="" /> <b>Инфо:</b></div>
';
echo '<div class="box1">Пользователей: ('.mysql_result(mysql_query("SELECT COUNT(id) FROM `users`"), 0).' из них <font color="green">'.mysql_result(mysql_query('SELECT COUNT(*) FROM `users` WHERE `rtime`>"'.intval( time( ) - 100 ).'"'),0).'</font> в чате)<br></div>';

///кто в прихожей
echo '<div class="box1">В прихожей: ';
$q_online = mysql_query( "SELECT `id`,`login`,`clogin` FROM users WHERE rtime>'".intval( time( ) - 100 )."' AND `room`='0' order by rtime desc;" );
while($donline = mysql_fetch_array($q_online)){

if($donline['clogin']==1){ $donline['login']='<font color="black">'.$donline['login'].'</font>'; }
if($donline['clogin']==2){ $donline['login']='<font color="#666">'.$donline['login'].'</font>'; }
if($donline['clogin']==3){ $donline['login']='<font color="#300">'.$donline['login'].'</font>'; }
if($donline['clogin']==4){ $donline['login']='<font color="red">'.$donline['login'].'</font>'; }
if($donline['clogin']==5){ $donline['login']='<font color="#f00">'.$donline['login'].'</font>'; }
if($donline['clogin']==6){ $donline['login']='<font color="#030">'.$donline['login'].'</font>'; }
if($donline['clogin']==7){ $donline['login']='<font color="green">'.$donline['login'].'</font>'; }
if($donline['clogin']==8){ $donline['login']='<font color="#0f0">'.$donline['login'].'</font>'; }
if($donline['clogin']==9){ $donline['login']='<font color="#003">'.$donline['login'].'</font>'; }
if($donline['clogin']==10){ $donline['login']='<font color="blue"><b><u>'.$donline['login'].'</b></u></font>'; }
if($donline['clogin']==10){ $donline['login']='<font color="#00f"><b><u>'.$donline['login'].'</b></u></font>'; }
if($donline['clogin']==10){ $donline['login']='<font color="330"><b><u>'.$donline['login'].'</b></u></font>'; }
if($donline['clogin']==10){ $donline['login']='<font color="yellow"><b><u>'.$donline['login'].'</b></u></font>'; }

if($donline['clogin']=="gradient"){
$gr = mysql_query("select `start`,`end` from `grN` where id_user='$donline[id]';" );
$gr_login = @mysql_fetch_array( @$gr );
$donline['login'] = GradientText("$donline[login]", "$gr_login[start]", "$gr_login[end]");
}

echo '<a href="/u'.$donline['id'].'">'.$donline['login']."</a>, ";

}
///

echo '</div>';
echo $_down;

}else{

header ("Location: /?"); exit;

}
?>











