Вход Регистрация
Файл: blog_ecsx/redact_post.php
Строк: 27
<?php
/*

** TJCompany
** Delovoper: TJersy
** Date: 11.2014

*/


$title = ('Изменения статьи');

require_once(
'private.files/core.file.php');

require_once(
'private.files/head.file.php');

if(!isset(
$user)){ $_SESSION['message'] = 'Сайт закрыт для гостей, авторизуйтесь или зарегистрируйтесь'header('Location: /');}

if (isset(
$_GET['id']) && $db->query("SELECT * FROM `articles` WHERE `id` = '".num($_GET['id'])."'") ->num_rows==true){

$i $db->query("SELECT * FROM `articles` WHERE `id`  = '".num($_GET['id'])."'")->fetch_assoc();

if(
$user['id'] != $i['id_user']){ header('Location: /');}

if(isset(
$_POST['new'])){

$theme text($_POST['theme']);

$text text($_POST['text']);

if(empty(
$theme)){ msg('Введите название темы');}

elseif(
strlen($text) < '300'){ msg('Текст статьи не должен быть меньше 300 символов');}

else{

$db-> query("UPDATE `articles` SET `theme` = '$theme', `text` = '$text' WHERE `id` = '$i[id]'");

header('Location:/post/'.$i['id'].'');

}
}



echo 
'<div class="name">Изменить статью</div><div class="wrap"><br/><form action="" method="POST"><center>
<a href="/bb-code"><img src="/design.files/bb-code.png"></a> <a href="/smiles"><img src="/design.files/smile.png"></a> <br/>
<input type="text" name="theme" value="'
.$i['theme'].'"><br/>
<textarea name="text" >'
.$i['text'].'</textarea><br/>
<input type="submit" name="new" value="Изменить статью"></center></form></div>'
;

}else{ 
msg('Статья не найдена');}
require_once(
'private.files/foot.file.php');

?>
Онлайн: 2
Реклама