<?php

require '../system/start.php';
require '../system/functions.php';
$str['mesto'] = 'Чат';
$str['block'] = $set['site'].' / Чат';
include '../style/'.$style.'/head.php';
reg ();
$chat = mysql_result(mysql_query("select count(*) from `users` where `where` = 'Чат' and time > ".(time()-300).""),0); 
mysql_query("DELETE FROM `chat_users` WHERE `time` < '".(time()-120)."' LIMIT 1");
$query = mysql_query("select * from `chat_rooms` order by `sort`");
echo '<div class="where"><img class="ico" src="../style/'.$style.'/ico/vote.gif" alt="" /> <a href="../chat/rate_um.php">Рейтинг умных</a><br/>
<img class="ico" src="../style/'.$style.'/ico/pr.gif" width="12" alt="" /> <a href="../chat/pravila.php">Правила чата</a>
</div>';
while ($row = mysql_fetch_assoc($query))
    
       
{
	$result = mysql_result(mysql_query("select count(*) from `chat_users` where `rid` = ".$row['id'].""),0);
              echo ' <div class="forum1">
	<img class="ico" src="../style/'.$style.'/ico/chatico.png" alt="" />
	<a href="room.php?id='.$row['id'].'">'.$row['title'].'</a> ('.$result.')<br/>
	</div>';
}
echo '<div class="where">

<a href="who.php">Кто-Где?</a>|
<a href="../pages/info.php?act=smiles">Смайлы</a> |
<a href="../pages/info.php?act=bbcode">BBcode</a> <br/>
</div>';
echo '<div class="on2">
Модераторы: ';

$r = mysql_query("SELECT * FROM `users` WHERE `level` = '5'");
$num = mysql_num_rows($r);
$i = 1;
while ($e = mysql_fetch_assoc($r)) {
	if ($i < $num)
		echo $e['login'] . ',';
	if ($i == $num)
		echo $e['login'];
	$i++;
}
if ($num == 0)
	echo 'Модераторов нет';
echo '</div>';

include '../style/'.$style.'/foot.php';
?>