Файл: modules/mail/newspaper/del_article.php
Строк: 45
<?php
$title = 'Удаление статьи';
include_once($_SERVER["DOCUMENT_ROOT"].'/style/head.php');
if($user['journalist']!=1 AND $user['level']<1){
error('Доступ запрещён.');
}
$_GET['id'] = abs(intval($_GET['id']));
if($db->query("SELECT `id` FROM `newspaper_article` WHERE `id`='".$_GET['id']."'")->num_rows==0){
error('Статьи не сущесвует.');
}
$article = $db->query("SELECT * FROM `newspaper_article` WHERE `id`=".$_GET['id']."")->fetch_assoc();
$section = $db->query("SELECT * FROM `newspaper_section` WHERE `id`=".$article['section']."")->fetch_assoc();
if(isset($_POST['yes'])){
$db->query("DELETE FROM `newspaper_article` WHERE `id`='".$_GET['id']."'");
$db->query("DELETE FROM `newspaper_comm` WHERE `id_artcile`='".$_GET['id']."'");
if($user['id']!=$article['id_us']){
$db->query("INSERT INTO `notifications` SET `id_us`='".$article['id_us']."', `time`='".time()."', `section`='newspaper_comm', `sender`='".$user['id']."', `text`='Удалил вашу статью.'");
}
header('location:/newspaper/section/'.$section['id']);
}elseif (isset($_POST['no'])) {
header('location:/newspaper/article/'.$article['id']);
}
?>
<div class="title">
<a href="/newspaper">Газета</a>
|
<a href="/newspaper/section/<?=$section['id']?>"><?=htmlspecialchars($section['name'])?></a>
|
<a href="/newspaper/article/<?=$article['id']?>"><?=htmlspecialchars($article['name'])?></a>
|
Удаление
</div>
<div class="text">
<form action="" method="POST">
Вы действительно хотите удалить данную статью?
<div class="quote">
<b><?=$article['name']?></b><br/>
<p><?=$article['content']?></p>
</div>
<input type="submit" name="yes" value="Да">
<input type="submit" name="no" value="Нет">
</form>
</div>
<?
include_once($_SERVER["DOCUMENT_ROOT"].'/style/foot.php');
?>