Файл: modules/news/edit_komm.php
Строк: 43
<?php
/* DCMS S (Special)
* Версия файла 0.0.1
* Дата последнего редактирования 14.10.2015
* Модифицировал densnet
*/
user::only_reg();
$post = mysql_fetch_array(mysql_query("SELECT * FROM `news_komm` WHERE `id` = '" . intval($_GET['edit_komm']) . "' LIMIT 1"));
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `news_komm` WHERE `id` = '$post[id]'"), 0) == 0) {
header("Location:?");
exit;
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `news` WHERE `id` = '$post[id_news]'"), 0) == 0) {
header("Location:?");
exit;
}
$news = mysql_fetch_array(mysql_query("SELECT * FROM `news` WHERE `id` = '$post[id_news]' LIMIT 1"));
$set['title'] = 'Новости "' . htmlspecialchars($news['title']) . '" - редактирование комментария';
require_once H . 'sys/inc/thead.php';
if (!isset($user)) {
header("Location:?news=$news[id]");
}
if (isset($user) && $user['level'] > 2 || $user['id'] == $post['id_user'] && $post['time'] > time() - 600) {
if (isset($_GET['ok']) && isset($_POST['msg'])) {
$msg = text::esc(stripcslashes(htmlspecialchars($_POST['msg'])));
if (text::utf8_strlen($msg) < 1) {
$err = 'Слишком короткое сообщение';
}
if (text::utf8_strlen($msg) > 10024) {
$err = 'Слишком длинное сообщение';
}
$msg = mysql_real_escape_string($msg);
if (!isset($err)) {
mysql_query("UPDATE `news_komm` SET `msg` = '$msg' WHERE `id` = '$post[id]' LIMIT 1");
header("Location: ?news=$news[id]");
}
}
err();
echo "<form class = 'comm' name = 'msg_edit' method = 'POST' action = '?edit_komm=$post[id]&ok'><center>";
echo "<b>Сообщение</b><br />";
echo text::auto_bb('msg_edit', 'msg');
echo "<textarea name = 'msg' >$post[msg]</textarea><br/>";
echo "<button class = 'flat blue'>Сохранить</button>";
echo "</center></form>";
echo "<div class = 'comm'><a href = '?news=$news[id]'><img src = '/style/icons/lext.png' /> Вернуться</a></div>";
} else {
header("Location: ?news=$news[id]");
}
require_once H . 'sys/inc/tfoot.php';