<?php
require_once '../core/system.php';
echo only_reg();
echo moder();
$header = 'Потверждение';
include_once '../core/head.php';
if(isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_razdel` WHERE `id` = '$get_id'"),0) == true) {
$razdel = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_razdel` WHERE `id` = '$get_id'"));
echo "<div class='player title'>Вы действительно хотите удалить этот раздел?</div>";
echo "<div class='mini-line'></div>";
echo "<div class='player menuList'>";
echo "<li><a href='delete_forum?id=$_GET[id]&amp;confirm=1'><img src='/images/icon/ok.png'>Да</a></li>";
echo "<li><a href='/forum?id=$_GET[id]'><img src='/images/icon/error.png'>Нет</a></li>";
echo "</div>";
}else{
header("Location: /forum");
$_SESSION['err'] = 'Раздел не найден!';
exit();
}

/*//if ($razdel['sub_forum'] == '1') {
if(isset($_GET['confirm']) == '1' && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_razdel` WHERE `id` = '$get_id'"),0) == true && $razdel['sub_forum'] == '1'){
mysql_query("DELETE FROM `forum_razdel` WHERE `id` = '$get_id'");
mysql_query("DELETE FROM `forum_comm` WHERE `id_razdel` = '$get_id'");
mysql_query("DELETE FROM `forum_topic` WHERE `id_razdel` = '$_GET[id]'");
header("Location: /forum");
$_SESSION['message'] = 'Раздел удалён!';
exit();
//}
//}Elseif ($razdel['main_forum'] == '1') {
}else*/
if(isset($_GET['confirm']) == '1' && mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_razdel` WHERE `id` = '".intval($_GET['id'])."'"),0) == true){
$sub_razdel = mysql_fetch_assoc(mysql_query("SELECT count(*) FROM `forum_razdel` WHERE `attached_to` = '".num($_GET['id'])."'"));
mysql_query("DELETE FROM `forum_razdel` WHERE `attached_to` = '$_GET[id]'");
mysql_query("DELETE FROM `forum_comm` WHERE `id_razdel` = '$_GET[id]'");
mysql_query("DELETE FROM `forum_comm` WHERE `id_razdel` = '$sub_razdel[id]'");
mysql_query("DELETE FROM `forum_topic` WHERE `id_razdel` = '$_GET[id]'");
mysql_query("DELETE FROM `forum_topic` WHERE `id_razdel` = '$sub_razdel[id]'");
mysql_query("DELETE FROM `forum_razdel` WHERE `id` = '$_GET[id]'");
header("Location: /forum");
$_SESSION['message'] = 'Раздел удалён!';
exit();
}
//}
//if(isset($_GET['confirm'])) {
//mysql_query("DELETE FROM `forum_razdel` WHERE `id` = '$_GET['confirm']'");
//header("Location: /forum/");
//$_SESSION['message'] = 'Раздел удалён!';
//exit();
//}
// Это не трогаем:)
if ($user['prava'] >= 4){
if(htmlspecialchars($_GET['clear']) == '1') {
$topics_to_del = intval($_GET['id']);
$del_topics = mysql_query("DELETE FROM `forum_topic` WHERE `id_razdel` = '".$topics_to_del."'");
}
}

include_once '../core/foot.php';
?>