<?php
define('NTLCMS', 1);
$module = 'all';
include ('../system/start.php');
include ('../system/function.php');
if (!$active){
header('Location: '.URL);
$_SESSION['fail'] = 'Вы не авторизированы!';
exit;
}
if ($_USER['admin'] == '1'){
$login = isset($_GET['login']) ? filter_var($_GET['login'], FILTER_SANITIZE_STRING) : false;
if (isset($_GET['login']) && DB :: run() -> querySingle("select * from `chat` where `login` = ?", array($login)) != NULL){
DB :: run() -> query("delete from `chat` where `login` = ?", array($login));
header('Location: '.URL.'/chats');
$_SESSION['success'] = 'Сообщения '.$login.' удалены!';
} else {
header('Location: '.URL.'/chats');
$_SESSION['success'] = 'Сообщения '.$login.' не удалены!';
}
} else {
header('Location: '.URL);
$_SESSION['fail'] = 'Доступ запрещен!';
}
?>