Просмотр файла libs/new_razd.php

Размер файла: 2.08Kb
  1. <?php
  2. /*
  3. =============================================
  4. Движок: SHCMS Engine
  5. =============================================
  6. Название файла: Библиотека
  7. =============================================
  8. Official website: http://shcms.ru
  9. =============================================
  10. Данный код защищен авторскими правами
  11. =============================================
  12. */
  13. define('SHCMS', true);
  14. include_once'../system/inc/basic_settings.php';
  15. $shcmsengine['title'] = 'Создании нового раздела';
  16. include_once'../template/head.php';
  17.  
  18. if($_POST['submit'])
  19. {
  20. $submit = $_POST['submit'];
  21. }
  22.  
  23. if(isset($submit))
  24. {
  25. if($_POST['name'])
  26. {
  27. $name = $_POST['name'];
  28. }
  29.  
  30. if($_POST['text'])
  31. {
  32. $text = $_POST['text'];
  33. }
  34.  
  35. if(empty($name))
  36. {
  37. echo '<div class="errors">Введите название раздела</div>';
  38. header("Refresh: 1; url=new_razd.php");
  39. include_once'../template/foot.php';
  40. exit;
  41. }
  42.  
  43. $ok_lib = mysql_query("INSERT INTO `libs` (`name`,`time`,`text`) VALUES ('$name','".time()."','$text')");
  44. if($ok_lib == true)
  45. {
  46. echo '<div class="actshcms">Раздел успешно создан</div>';
  47. header("Refresh: 1; url=/libs/");
  48. include_once'../template/foot.php';
  49. exit;
  50. }
  51. else
  52. {
  53. echo '<div class="actshcms">Ошибка при создании раздела</div>';
  54. header("Refresh: 1; url=new_razd.php");
  55. include_once'../template/foot.php';
  56. exit;
  57. }
  58. }
  59.  
  60.  
  61. echo '<form action="?" method="post">';
  62. echo 'Название раздела:<br/><input type="text" name="name"><br/>';
  63. echo 'Описание раздела:<br/><textarea id="text" name="text"></textarea><br/>';
  64. echo '<input type="submit" name="submit" value="Создать">';
  65. echo '</form>';
  66.  
  67. include_once'../template/foot.php';
  68. ?>