<?php
define('NTLCMS', 1);
$module = 'delads';
include ('../system/start.php');
include ('../system/function.php');
include ('../system/antidos.php');
if (!$active){
header('Location: '.URL);
$_SESSION['fail'] = 'Вы не авторизированы!';
exit;
}
if (isset($_GET['id'])){
$id = isset($_GET['id']) ? filter_var($_GET['id'], FILTER_SANITIZE_NUMBER_INT) : '0';
if (DB :: run() -> querySingle("select count(`id`) from `reklama` where `login` = ? and `id` = ?", array($ulogin, $id))){
if (DB :: run() -> query("delete from `reklama` where `id` = ? and `login` = ? limit 1", array($id, $ilogin))){
DB :: run() -> query("delete from `reklama_stat` where `rid` = ?", array($id));
header('Location: '.URL.'/advert');
$_SESSION['success'] = 'Реклама успешно удалена!';
} else {
header('Location: '.URL.'/advert');
$_SESSION['fail'] = 'Реклама не удалена!';
}
} else {
header('Location: '.URL.'/advert');
$_SESSION['fail'] = 'Действие запрещено!';
}
}
?>