Файл: bloodlands.pw/forum/count.php
Строк: 24
<?
$_messForS = mysql_result(mysql_query("SELECT COUNT(id) FROM f_message"), 0);
$_messForT = mysql_result(mysql_query("SELECT COUNT(id) FROM f_them"), 0);
$k_t= mysql_result(mysql_query("SELECT COUNT(*) FROM `f_them` WHERE `date` > '".(time()-86400)."'"),0);
if ($k_t==0)$k_t=NULL;
else $k_t='+'.$k_t;
$tem = "<font color='red'>$k_t</font>";
$k_m= mysql_result(mysql_query("SELECT COUNT(*) FROM `f_message` WHERE `time` > '".(time()-86400)."'"),0);
if ($k_m==0)$k_m=NULL;
else $k_m='+'.$k_m;
$mess = "<font color='red'>$k_m</font>";
echo '<div class="title"><a href="forum/"> Форум мастеров</a> (' . $_messForT . '' . $tem . '/' . $_messForS . '' . $mess . ')</div>';
// Вывод форума
$inForum = mysql_query("SELECT f_them .*, (SELECT COUNT(id) FROM f_message WHERE f_message.tid = f_them.id) AS s
FROM f_them ORDER BY last DESC, id DESC LIMIT 5");
if (mysql_num_rows($inForum) != false)
{
while($inF = mysql_fetch_assoc($inForum))
{
if ($inF['s'] > 10) {
$pg = ceil($inF['s'] / 10);
$st = '&page=' . $pg;
} else {
$st = '';
}
if ($inF['close'] == 1 && $inF['fix'] == 0) {
$cl2 = '<img src="ico/f_zakryt.gif" alt="*"/>';
} elseif ($inF['close'] == 0 && $inF['fix'] == 0) {
$cl2 = '<img src="ico/f.gif" alt="*"/>';
} elseif ($inF['fix'] == 1) {
$cl2 = '<img src="ico/f_zakrep.gif" alt="*"/>';
} else {
$cl2 = '<img src="ico/f.gif" alt="*"/>';
}
echo '<div class="menu"><a class="ssyl2" href="forum/?do=them&r='.$inF['razdel_id'].'&p='.$inF['rid'].'&t='.$inF['id'].$st.'"> ' . $cl2 . ' ' . $inF['name'] . ' (' . $inF['s'] . ')</a></div>';
}
}
echo '</div>';
?>