Файл: forum/index.php
Строк: 26
<?php
require_once '../ini/sys.php';
$title = 'Форум';
require_once(HOME .'/ini/head.php');
echo '<div class="main"><a href="new_them.php">Последние темы</a> |</div>';
if($forumr == 0)echo '<div class="err">Нет разделов в форуме =(</div>';
$q2 = mysql_query('SELECT * FROM `forumr`');
while($razdel = mysql_fetch_assoc($q2)){
echo '<div class="aut"><img src="img/razdel.png"></img> <a href="'.$razdel['id'].'">'.output($razdel['name']).'</a>';
if($admin >= 14)echo ' <a href="add.php?mod=edit&id='.$razdel['id'].'">[<img src="img/edit.png"></img>]</a>';
echo '</div>';
if($user['open_forum'] == 0){
$q = mysql_query("SELECT * FROM `forums` WHERE razdel = '".$razdel['id']."'");
while($forum = mysql_fetch_array($q)){
$tfo = mysql_result(mysql_query("SELECT COUNT(*) FROM forumt WHERE forums = '$forum[id]'"),0);
$pt = mysql_result(mysql_query("SELECT COUNT(*) FROM `forump` WHERE `forums` = '$forum[id]' AND `razdel` = '$razdel[id]'"),0);
echo '<div class="menu"><img src="img/for.png"></img> <a href="'.$razdel['id'].'/'.$forum['id'].'">'.output($forum['name']).'</a> ('.$tfo.'/'.$pt.')</div>';
}}
$ct = mysql_result(mysql_query("SELECT COUNT(id) FROM forumt WHERE razdel = '$razdel[id]'"),0);
if($ct > 0){
$tem = mysql_fetch_assoc(mysql_query("SELECT id,name,forums,user FROM forumt WHERE razdel = '$razdel[id]' ORDER BY timenew DESC LIMIT 1"));
echo '<div class="cit">Последняя тема: ';
echo '<br /><img src="/forum/img/them.png"></img> <a href="/forum/'.$razdel['id'].'/'.$tem['forums'].'/'.$tem['id'].'/page=end">'.$tem['name'].'</a> ['.mysql_result(mysql_query("SELECT COUNT(id) FROM forump WHERE tema = '$tem[id]'"),0).']<br />Автор: ';
ank($tem['user']);
echo '</div>';
}}
if($admin >= 14)echo '<div class="razd"><a href="add.php">Управление форумом.</a></div>';
require_once(HOME .'/ini/end.php');
?>