Файл: chat/inc/who.php
Строк: 11
<?
// Обновление информации
if (isset($user) && mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_who` WHERE `id_user` = '$user[id]'"),0) == 0) {
mysql_query("INSERT INTO `chat_who` (`id_user`, `time`, `room`) values('$user[id]', '$time', '0')");
} elseif (isset($user)) {
mysql_query("UPDATE `chat_who` SET `room` = '0', `time` = '$time' WHERE `id_user` = '$user[id]' LIMIT 1");
}
$set['title'] = __('Кто в чате?');
include_once H.'sys/inc/thead.php';
title();
aut();
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_who` WHERE `time` > '" . (time() - 120) . "'"), 0);
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = ($set['p_str'] * $page) - $set['p_str'];
?><table class="post"><?
if ($k_post == 0)
{
?>
<div class="mess">
<?= __('Сейчас в чате никого нет')?>
</div>
<?
}
$q = mysql_query("SELECT * FROM `chat_who` WHERE `time` > '" . (time() - 120) . "' ORDER BY time DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_assoc($q)) {
$num++;
?><div class="<?= ($num % 2 ? 'nav2' : 'nav1')?>"><?
echo user::avatar($post['id_user'], 0) . user::nick($post['id_user'], 1, 1, 1);
?></div><?
}
?>
</table>
<?
if ($k_page > 1) {
str('?func=who&all&', $k_page, $page);
}
?>
<div class="foot">
<img src="/style/icons/str2.gif" alt="*" /> <a href="?"><?= __('Прихожая')?></a><br />
</div>