<?
##########################################
## Автор: -=ШАХТЕР=-                        #                                                                                                                                                                                      ## Сайт: http://masteram.us                 #                 															                      ## ICQ  :  46-92-90                         #                 														 		           ## Версия 4.0                   #
## Данная версия скрипта является ПЛАТНОЙ,  #
## вы НЕ ИМЕЕТЕ ПРАВА распрострянять данный #
##  скрипт или какие-либо части его кода... #
#########################################
require'config.php';
$user['avr'] = 0;
$align='left';
$title='Кто где?-'.$db->sql_fetchfield($db->sql_query('SELECT COUNT(*) FROM `who`'),0);
aut();
head();
if (!isset($user['user'])) { exit('Ошибка!Вам надо авторизоваться');}


if ($ver=='xhtml')echo '<div style="margin-left:2%">';
echo '<br />';
$rooms = $db->sql_query("SELECT * FROM `rooms` ORDER BY `pos` ASC");
if($db->sql_numrows($rooms)!=0){
while($room = $db->sql_fetchrow($rooms)){

if ($room['sartir']==1)echo '<a href="room?rm='.$room['rm'].'&amp;sartir">'.$room['name'].'</a>('.$db->sql_fetchfield($db->sql_query('SELECT COUNT(*) FROM `who` WHERE `room` = "room" and `rm` = "'.$room['rm'].'"'),0).')<br />';
else if ($room['intim']==1)echo '<a href="room?rm='.$room['rm'].'&amp;intim">'.$room['name'].'</a>('.$db->sql_fetchfield($db->sql_query('SELECT COUNT(*) FROM `who` WHERE `room` = "room" and `rm` = "'.$room['rm'].'"'),0).')<br />';
else if ($room['level']<=$user['level'])echo '<a href="room?rm='.$room['rm'].'">'.$room['name'].'</a>('.$db->sql_fetchfield($db->sql_query('SELECT COUNT(*) FROM `who` WHERE `room` = "room" and `rm` = "'.$room['rm'].'"'),0).')<br />';


if (($room['intim']!=1)&&($room['inkog']!=1)){
$whos = $db->sql_query("SELECT * FROM `who` WHERE `room` = 'room' and `rm` = '$room[rm]' ORDER BY `time` DESC");
if($db->sql_numrows($whos)>1) $zp = ', '; else $zp = '';
while($who = $db->sql_fetchrow($whos)){
echo gbinroom.nik($who['user']).$zp.div;
$user_wh = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$who['user']."'"));
echo "<b>Статус:</b> <font color='#FF0000'><b>".$user_wh['status']."</b></font><br />";
}

if($db->sql_numrows($whos)>0)echo '<br />';
}
}

}else{
echo 'Комнаты не созданны<br />';
}
echo '<dl><dt></dt></dl>';
$whos = $db->sql_query("SELECT * FROM `who` WHERE `room` != 'enter' and `room` != 'room'  ORDER BY `time` DESC");
if($db->sql_numrows($whos)>1) $zp = ', '; else $zp = '';
echo head0.'<a href="forum">На Форуме</a> ('.$db->sql_numrows($whos).')<br />'.div;
while($who = $db->sql_fetchrow($whos)){
echo gbinroom.nik($who['user']).$zp.div;
$user_wh = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$who['user']."'"));
echo "<b>Статус:</b> <font color='#FF0000'><b>".$user_wh['status']."</b></font><br />";
}
echo '<dl><dt></dt></dl>';
$whos = $db->sql_query("SELECT * FROM `who` WHERE `room` = 'enter' ORDER BY `time` DESC");
if($db->sql_numrows($whos)>1) $zp = ', '; else $zp = '';
echo head0.'<a href="enter">В прихожей</a> ('.$db->sql_numrows($whos).')<br />'.div;
while($who = $db->sql_fetchrow($whos)){
echo gbinroom.nik($who['user']).$zp.div;
$user_wh = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '".$who['user']."'"));
echo "<b>Статус:</b> <font color='#FF0000'><b>".$user_wh['status']."</b></font><br />";
}

if($db->sql_numrows($whos)>0)echo '<br />';
if ($ver=='xhtml')echo '</div>';
echo '<br />';
echo gb.'<a href="'.H.'enter">Прихожая</a>'.div;


foot();
ob_end_flush();
?>
