Просмотр файла forum/razd_new.php

Размер файла: 2.25Kb
  1. <?
  2. /*
  3. =============================================
  4. Движок: SHCMS Engine
  5. =============================================
  6. Название файла: Форум
  7. =============================================
  8. Official website: http://shcms.ru
  9. =============================================
  10. */
  11. define('SHCMS', true);
  12. include_once'../system/inc/basic_settings.php';
  13. $shcmsengine['title'] = 'Создать новый раздел';
  14. include_once'../template/head.php';
  15. registrat();
  16. if($user4['team'] == 6)
  17. {
  18.  
  19.  
  20.  
  21. if($_POST['submit'])
  22. {$submit = $_POST['submit'];}
  23.  
  24.  
  25. if(isset($submit))
  26. {
  27. if($_POST['name'])
  28. {$name = $_POST['name'];}
  29. if($_POST['message'])
  30. {$message = $_POST['message'];}
  31.  
  32.  
  33. if(empty($name))
  34. {
  35. echo'<div class="errors">Введите название</div>';
  36. include_once'../template/foot.php';
  37. exit();
  38. }
  39. if(empty($message))
  40. {
  41. echo'<div class="errors">Введите описание</div>';
  42. include_once'../template/foot.php';
  43. exit();
  44. }
  45. if(strlen($name)< 0 || strlen($name) >30)
  46. {
  47. echo'<div class="errors">название должен быть не больше 30 символов</div>';
  48. exit();
  49. }if(strlen($message)< 0 || strlen($message) >255)
  50. {
  51. echo'<div class="errors">Описание должен быть не больше 255 символов</div>';
  52. exit();
  53. }
  54. $name = trim($name);
  55. $name = stripslashes($name);
  56. $name = htmlspecialchars($name);
  57.  
  58.  
  59.  
  60. if(isset($name) && isset($message))
  61. {
  62. $mysql_ok = mysql_query("INSERT INTO forum_cat (name,message,time) VALUES ('$name','$message','$time_date')");
  63. if($mysql_ok == true)
  64. {
  65. echo'<div class="actshcms">Раздел успешно создан</div>';
  66. echo'<div class="uncom"><a href="razd_new.php">Назад</a></div>';
  67. exit();
  68. }
  69. else
  70. {
  71. echo'<div class="errors">Ошибка создании нового раздела</div>';echo'<div class="uncom"><a href="razd_new.php">Назад</a></div>';exit();
  72. }}
  73.  
  74.  
  75. }
  76. echo '<form action="?'.$conservation.'" method="post">"';
  77. echo 'Название:<br/><input type="text" name="name"><br/>';
  78. echo 'Описание:<br/><input type="text" name="message"><br/>';
  79. echo '<input type="submit" name="submit"></form>';
  80.  
  81. }
  82. else
  83. {
  84. header('Refresh: 1; url=./');
  85. }
  86. include_once'../template/foot.php';
  87. ?>