Вход Регистрация
Файл: blog_ecsx/new_post.php
Строк: 32
<?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 `category` WHERE `id` = '".num($_GET['id'])."'") ->num_rows==true){

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


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("INSERT INTO `moderation` SET `theme` = '$theme', `text` = '$text', `time` = '".time()."',`id_user` = '$user[id]',`id_category` = '$i[id]'");


$event 'Ваша статья [color=green]'.$theme.'[/color] успешно отправлена на модерацию. Дождитесь ответа от администрации';

$db-> query("INSERT INTO `journal` SET `event` = '$event', `theme` = 'Модерация статьи', `time` = '".time()."',`id_user` = '$user[id]',`status` = '1'");

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

}
}

//<a href="/bb-code"><img src="/design.files/bb-code.png"></a> <a href="/smiles"><img src="/design.files/smile.png"></a> <br/>


echo '<div class="wrap"><br/><form action="" method="POST"><center> <h2> Категория: '.$i['name'].'  </h2>
<input type="text" name="theme" placeholder="Введите название темы..."><br/>
<textarea name="text" placeholder="Введите сообщение..."></textarea><br/>
<input type="submit" name="new" value="Добавить статью на модерацию"></center></form></div>'
;

}else{ 
msg('Категория не найдена');}
require_once(
'private.files/foot.file.php');

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