Файл: forum/post/index.php
Строк: 51
<?
require_once '../../core/system.php';
echo only_reg();
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_razdel` WHERE `id` = '".intval($_GET['id'])."'"),0) == true){
$razdel = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_razdel` WHERE `id` = '".intval($_GET['id'])."'"));
}else{
$_SESSION['err'] = "Раздел не найден!";
header('Location: /forum/');
exit();
}
$header = $razdel[name];
require_once '../../core/head.php';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topic` WHERE `id_razdel` = '$razdel[id]'"),0);
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str']*$page-$set['p_str'];
$q = mysql_query("SELECT * FROM `forum_topic` WHERE `id_razdel` = '$razdel[id]' AND `verh` = '0' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
$p = mysql_query("SELECT * FROM `forum_topic` WHERE `id_razdel` = '$razdel[id]' AND `verh` = '1' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
if($k_post == 0)echo "<div class='player grey'>В этом разделе нет топиков!</div><div class='mini-line'></div>";
echo "<div class='player menuList'>";
while($post2 = mysql_fetch_assoc($p)) {
$num = mysql_result(mysql_query("SELECT count(id) FROM forum_comm where id_topic='$post2[id]'", $db), 0);
echo "<li><a style='font-weight:bold;' href='/forum/post/topic/$post2[id]/?page=end'><img src='/images/icon/section_new.png'>$post2[name] ($num)</a></li>";
echo "<div class='dot-line'></div>";
}
while($post = mysql_fetch_assoc($q)) {
$num2 = mysql_result(mysql_query("SELECT count(id) FROM forum_comm where id_topic='$post[id]'", $db), 0);
echo "<li><a href='/forum/post/topic/$post[id]/?page=end'><img src='/images/icon/section_new.png'>";
if($post[close] == 1){
echo "<span class='quality-4'>$post[name]</span> ($num2)</a></li>";
}else{
echo "$post[name] ($num2)</a></li>";
}
echo "<div class='dot-line'></div>";
}
echo "</div>";
if ($k_page>1){
str('?',$k_page,$page); // Вывод страниц
echo "<div class='mini-line'></div>";
}
echo "<div class='player menuList'>";
echo "<li><a href='/forum/new_topic.php?id=$razdel[id]'><img src='/images/icon/section_new.png'>Создать новый топик</a></li>";
echo "<li><a href='/user/admin2.php'><img src='/images/icon/user.png'>Администрация</a></li>";
echo "<li><a href='/forum/'><img src='/images/icon/section.png'>Вернуться к разделам</a></li>";
echo "</div>";
require_once '../../core/foot.php';
?>