Размер файла: 2.28Kb
- <?
- /*
- =============================================
- Движок: SHCMS Engine
- =============================================
- Название файла: Добавление Новости
- =============================================
- Official website: http://shcms.ru
- =============================================
- */
-
- define('SHCMS', true);
- include_once'../system/inc/basic_settings.php';
- $adminka->admin();
- $shcmsengine['title'] = 'Добавить новость';
- include_once'../template/head.php';
- if(isset($_POST['submit']))
- {$submit = $_POST['submit'];}
- if($submit)
- {
- if(isset($_POST['title']))
- {$title = $_POST['title'];}
- if(isset($_POST['text']))
- {$text= $_POST['text'];}
-
- $title = htmlspecialchars($title);
- $text = htmlspecialchars($text);
- $title = stripslashes($title);
-
-
- if(strlen($title) <0 || strlen($title) >50)
- {
- echo '<div class="errors">Название должно быть не больше 50 символов</div>';
- include_once'../template/foot.php';
- exit();
- }
- if(strlen($text) <0 || strlen($text) >2400)
- {
- echo '<div class="errors">Описание должно быть не больше 2400 символов</div>';
- include_once'../template/foot.php';
- exit();
- }
-
-
- if(empty($title) or empty($text))
- {
- echo '<div class="errors">Заполните все поля</div>';
- include_once'../template/foot.php';
- exit();
- }
- }
- if(isset($title) && isset($text))
- {
- $shcms_my = mysql_query("INSERT INTO uncos (author,title,text,time,user) VALUES ('$login','$title','$text','$time_date','$user_id')");
- if($shcms_my == true)
- {
- echo '<div class="actshcms">Новость успешно опубликовано.</div>';
- echo '<div class="uncom"><a href="/uncos/">Назад</a></div>';
- include_once'../template/foot.php';exit();}
- else{'<div class="errors">Ошибка добавление новости.</div>';}
-
- }
- echo '<form action=?'.$conservation.' method="post" name="form">';
- echo 'Название:<br/><input type="text" name="title"><br/>';
- if($brodilka == "web")
- {
- $text_list->text_lister();
- }
- echo 'Текст<br/><textarea name="text"></textarea>';
- echo '<input type="submit" name="submit" value="Опубликовать">';
-
- echo '<div class="lower"><a href="/uncos/">Назад<a></div>';
-
- include_once'../template/foot.php';
- ?>