<?
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)) {
echo "<li><a style='font-weight:bold;' href='/forum/post/topic/$post2[id]/?page=end'><img src='/images/icon/section_new.png'>$post2[name]</a></li>";
echo "<div class='dot-line'></div>";
}
while($post = mysql_fetch_assoc($q)) {
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='grey'>$post[name]</span></a></li>";
}else{
echo "$post[name]</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/moder.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';
?>