<?
require'config.php';
$user['avr'] = 0;
$align='center';
$title='Кто где?-'.$db->sql_fetchfield($db->sql_query('SELECT COUNT(*) FROM `who`'),0);
aut();
head();

//require'sys/ng2.php';//вывод времени до нового года
//echo '<font color="green">Доступен дополнительный адресс чата </font> <a href="http://vivawap.ru"><b>vivawap.ru</b></a><br />';

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


if (($room['intim']!=1)&&($room['inkog']!=1) or $user['level']==9){
$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 nik($who['user']).$zp;

}

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 '<a href="forum">Форум ('.$db->sql_numrows($whos).')</a><br />';
while($who = $db->sql_fetchrow($whos)){
echo nik($who['user']).$zp;
}





echo '<br />';
$whos = $db->sql_query("SELECT * FROM `who` WHERE `room` = 'enter' ORDER BY `time` DESC");
if($db->sql_numrows($whos)>1) $zp = ', '; else $zp = '';
echo '<a href="enter">Прихожая ('.$db->sql_numrows($whos).')</a><br />';
while($who = $db->sql_fetchrow($whos)){
echo nik($who['user']).$zp;
}

if($db->sql_numrows($whos)>0)echo '<br />';
if ($ver=='xhtml')echo '</div>';
echo '<br />';
echo gb.'<a href="'.H.'enter">Прихожая</a>'.div;
info_compress();
echo 'Время:'.$debag->endTimer().' сек<br />'.div;
foot();
ob_end_flush();
?>