Файл: modules/mail/newspaper/del_section.php
Строк: 32
<?php
$title = 'Газета | Удаление категории';
include_once($_SERVER["DOCUMENT_ROOT"].'/style/head.php');
mode('user');
level(1);
$_GET['id'] = abs(intval($_GET['id']));
if($db->query("SELECT `id` FROM `newspaper_section` WHERE `id`='".$_GET['id']."'")->num_rows==0){
error('Категории не существует.');
}
$section = $db->query("SELECT * FROM `newspaper_section` WHERE `id`='".$_GET['id']."'")->fetch_assoc();
if(isset($_POST['yes'])){
$db->query("DELETE FROM `newspaper_section` WHERE `id`=".$_GET['id']."");
$q = $db->query("SELECT * FROM `newspaper_article` WHERE `section`='".$_GET['id']."'");
while ($qw = $q->fetch_assoc()) {
$db->query("DELETE FROM `newspaper_comm` WHERE `id_article`='".$qw['id']."'");
$db->query("DELETE FROM `newspaper_article` WHERE `id`='".$qw['id']."'");
}
header('location:/newspaper');
}elseif(isset($_POST['no'])){
header('location:/newspaper');
}
?>
<div class="title"><a href="/newspaper">Газета</a> | Удаление категории</div>
<div class="text">
Вы действительно хотите удалить категорию <?=output($section['name'])?>?<br/>
<form action="" method="POST">
<input type="submit" name="yes" value="Да">
<input type="submit" name="no" value="Нет">
</form>
</div>
<?
include_once($_SERVER["DOCUMENT_ROOT"].'/style/foot.php');
?>