Размер файла: 1.3Kb
<?
$k_room=0;
$q = mysql_query("SELECT * FROM $mysql[pref]chat_room");
while ($rooms = mysql_fetch_array($q))
{
$room[$k_room]=$rooms;
$k_room++;
}
if ($k_room>0)
{
usort ($room, "sroom");
echo "<div class=\"menu\">\n";
for ($i=0;$i<$k_room;$i++)
{
if (isset($user) && $user['level']>2 && $user['slinks']==0)
{
echo "<a href=\"set_r.php?id_r=".$room[$i]['id']."\">\n";
}
echo "<img src=\"../SYSTEM/themes/$them/img/chat/room.gif\" alt=\"\" />";
if (isset($user) && $user['level']>2 && $user['slinks']==0)
{
echo "</a>\n";
}
echo " <a href=\"index.php?id_r=".$room[$i]['id']."\"><b>".$room[$i]['name']."</b></a> ";
$livetime_chat=time()-($set['time_sess']/2);
$q = mysql_query("SELECT COUNT(DISTINCT id_us) FROM `$mysql[pref]chat_who` WHERE `time` >= '$livetime_chat' AND `id_r` = '".$room[$i]['id']."';");
echo "[".mysql_result($q, 0)."]";
echo "<br />\n";
}
echo "</div>\n";
}
else
{
echo "Нет комнат<br />\n";
}
echo "<hr />\n";
if (isset($user) && $user['level']>2 && $user['slinks']==0)
{
echo "<a href=\"add_r.php\">Добавить комнату</a><br />\n";
}
if (isset($user) && $user['level']>0 && $user['slinks']==0)
{
echo "<a href=\"clear.php\">Очистка чата</a><br />\n";
}
if (isset($user))
{
mysql_query("DELETE FROM `$mysql[pref]chat_who` WHERE `id_us` = '".$user['id']."';");
}
?>