Файл: Arhmobi_esdcms/faq/faq.del.php
Строк: 17
<?php
/*Автор: Fox(Red_Energy) http://dcms.su/ */
include_once '../sys/inc/start.php';
$doc = new document(4);
$doc->title = __('Удаление вопроса');
if (!isset($_GET ['id']) || !is_numeric($_GET ['id'])) {
if (isset($_GET ['return']))
header('Refresh: 1; url=' . $_GET ['return']);
else
header('Refresh: 1; url=./');
$doc->err(__('Ошибка выбора вопроса'));
exit();
}
$id_faq = (int) $_GET ['id'];
$q = $db->prepare("SELECT * FROM `faq` WHERE `id` = ? LIMIT 1");
$q->execute(Array($id_faq));
if (!$faq = $q->fetch()) {
if (isset($_GET ['return']))
header('Refresh: 1; url=' . $_GET ['return']);
else
header('Refresh: 1; url=./');
$doc->err(__('Вопрос не найден'));
exit();
}
$res = $db->prepare("DELETE FROM `faq` WHERE `id` = ? LIMIT 1");
$res->execute(Array($id_faq));
$db->query("ALTER TABLE `faq` AUTO_INCREMENT = 5");
$doc->msg(__('Вопрос успешно удален'));
$dcms->log('Faq', "Удаление faq" . $faq['faqq']);
if (isset($_GET ['return']))
header('Refresh: 1; url=' . $_GET ['return']);
else
header('Refresh: 1; url=./?' . SID);
if (isset($_GET ['return']))
$doc->ret(__('Вернуться'), text::toValue($_GET ['return']));
else
$doc->ret(__('Вернуться'), './');