Просмотр файла uncos/add_news.php

Размер файла: 2.28Kb
  1. <?
  2. /*
  3. =============================================
  4. Движок: SHCMS Engine
  5. =============================================
  6. Название файла: Добавление Новости
  7. =============================================
  8. Official website: http://shcms.ru
  9. =============================================
  10. */
  11.  
  12. define('SHCMS', true);
  13. include_once'../system/inc/basic_settings.php';
  14. $adminka->admin();
  15. $shcmsengine['title'] = 'Добавить новость';
  16. include_once'../template/head.php';
  17. if(isset($_POST['submit']))
  18. {$submit = $_POST['submit'];}
  19. if($submit)
  20. {
  21. if(isset($_POST['title']))
  22. {$title = $_POST['title'];}
  23. if(isset($_POST['text']))
  24. {$text= $_POST['text'];}
  25.  
  26. $title = htmlspecialchars($title);
  27. $text = htmlspecialchars($text);
  28. $title = stripslashes($title);
  29.  
  30.  
  31. if(strlen($title) <0 || strlen($title) >50)
  32. {
  33. echo '<div class="errors">Название должно быть не больше 50 символов</div>';
  34. include_once'../template/foot.php';
  35. exit();
  36. }
  37. if(strlen($text) <0 || strlen($text) >2400)
  38. {
  39. echo '<div class="errors">Описание должно быть не больше 2400 символов</div>';
  40. include_once'../template/foot.php';
  41. exit();
  42. }
  43.  
  44.  
  45. if(empty($title) or empty($text))
  46. {
  47. echo '<div class="errors">Заполните все поля</div>';
  48. include_once'../template/foot.php';
  49. exit();
  50. }
  51. }
  52. if(isset($title) && isset($text))
  53. {
  54. $shcms_my = mysql_query("INSERT INTO uncos (author,title,text,time,user) VALUES ('$login','$title','$text','$time_date','$user_id')");
  55. if($shcms_my == true)
  56. {
  57. echo '<div class="actshcms">Новость успешно опубликовано.</div>';
  58. echo '<div class="uncom"><a href="/uncos/">Назад</a></div>';
  59. include_once'../template/foot.php';exit();}
  60. else{'<div class="errors">Ошибка добавление новости.</div>';}
  61.  
  62. }
  63. echo '<form action=?'.$conservation.' method="post" name="form">';
  64. echo 'Название:<br/><input type="text" name="title"><br/>';
  65. if($brodilka == "web")
  66. {
  67. $text_list->text_lister();
  68. }
  69. echo 'Текст<br/><textarea name="text"></textarea>';
  70. echo '<input type="submit" name="submit" value="Опубликовать">';
  71.  
  72. echo '<div class="lower"><a href="/uncos/">Назад<a></div>';
  73.  
  74. include_once'../template/foot.php';
  75. ?>