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

Размер файла: 2.99Kb
  1. <?
  2. /*
  3. =============================================
  4. Движок: SHCMS Engine
  5. =============================================
  6. Название файла: Форум
  7. =============================================
  8. Official website: http://shcms.ru
  9. =============================================
  10. */
  11. define('SHCMS', true);
  12. if($_GET['id']){$id = $_GET['id'];}
  13. include_once'../system/inc/basic_settings.php';
  14. $themes = mysql_fetch_array(mysql_query("SELECT * FROM `forum_razd` WHERE id=$id"));
  15. $shcmsengine['title'] = 'Создать новую тему в разделе '.$themes['name'].'';
  16. include_once'../template/head.php';
  17. registrat();
  18.  
  19.  
  20. if($_POST['prosmotr'])
  21. {$prosmotr = $_POST['prosmotr'];}
  22.  
  23. if(isset($prosmotr))
  24. {
  25.  
  26. if($_POST['text'])
  27. {$text = $_POST['text'];}
  28.  
  29. if(empty($text))
  30. {
  31. errors('Вы не ввели текст');
  32. include_once'../template/foot.php';
  33. exit;
  34. }
  35.  
  36. echo '<div class="maintitle">';
  37. echo ''.users_profile($user_id).'</div>';
  38.  
  39. echo '<div class="maintext">'.$_POST['text'].'</div>';
  40.  
  41. include_once'../template/foot.php';
  42. exit;
  43. }
  44.  
  45.  
  46.  
  47.  
  48. $q = mysql_query("SELECT * FROM `forum_razd` WHERE `id` = '$id'");
  49. if (!mysql_num_rows($q)) {
  50. header('Refresh: 1; url=./');
  51. echo 'В данном разделе нельзя создавать темы';
  52. include_once'../template/foot.php';
  53. exit();
  54. }
  55.  
  56. if($_POST['submit']) {
  57. $submit = $_POST['submit'];
  58. }
  59.  
  60. if(isset($submit)) {
  61.  
  62. if($_POST['name']) {
  63. $name = $_POST['name'];
  64. }
  65. if($_POST['text']) {
  66. $text = $_POST['text'];
  67. }
  68.  
  69. if(isset($name) && isset($text)) {
  70.  
  71. $themesdb = mysql_query("INSERT INTO `forum_them` (`id_razd`,`id_cat`,`name`,`time`,`user_id`) VALUES ('$id',$themes[id_cat],'$name','$time_date','$user_id')");
  72. $unid = mysql_fetch_array(mysql_query("SELECT * FROM `forum_them` WHERE `id_razd` = '$id' ORDER BY `id` DESC"));
  73. mysql_query("INSERT INTO `forum_mess` (`id_cat`,`id_razd`,`id_them`,`id_user`,`message`,`time`) VALUE ('$themes[id_cat]','$id','$unid[id]','$user_id','$text','".time()."')");
  74.  
  75.  
  76. if($themesdb == true) {
  77. echo'<div class="actshcms">Тема успешно создана</div>';
  78. header('Refresh: 1; url=message.php?id='.$unid['id'].'&' . $conservation . '&' );
  79. include_once'../template/foot.php';
  80. exit();
  81. } else {
  82. echo'<div class="errors">Ошибка создании нового раздела</div>';
  83. header('Refresh: 1; url=them.php?id='.$id.'&' . $conservation . '&' );
  84. include_once'../template/foot.php';
  85. exit; }}
  86.  
  87. }
  88.  
  89. echo '<form action="?id='.$id.'" method="post">';
  90. echo 'Название темы:<br/><input type="text" name="name"><br/>';
  91. echo 'Сообщение:<br/><textarea id="text" name="text"></textarea><br/>';
  92. echo '<br/><input type="submit" name="submit" value="Создать тему">
  93. <input type="submit" name="prosmotr" value="Предпросмотр"></form>';
  94.  
  95.  
  96. echo '<div class="posts"><a href="them.php?id='.$id.'">Назад</a></div>';
  97. include_once'../template/foot.php';
  98. ?>