Просмотр файла download/comment.php

Размер файла: 3.34Kb
  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. if($_GET['id'])
  14. {$id = $_GET['id'];}
  15. $file2 = mysql_fetch_array(mysql_query("SELECT * FROM download_file WHERE id=$id"));
  16. $shcmsengine['title'] = 'Комментарии к файлу '.$file2['names'].'';
  17.  
  18. $user_s = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id=$user_id"));
  19.  
  20. include_once'../template/head.php';
  21.  
  22.  
  23. if(!$id)
  24. {
  25. echo '<div class="errors">Вы неправильно зашли</div>';
  26. header("Refresh: 1; url=/download/");
  27. include_once'../template/foot.php';
  28. exit();
  29. }
  30.  
  31. if(isset($user_id))
  32. {
  33. if($brodilka == "web")
  34. {
  35. $text_list->text_lister();
  36. }
  37. echo '<form action?id='.$id.'&'.$conservation.'" method="post" name="form">';
  38. echo 'Текст комментария:<br/><textarea name="text"></textarea>';
  39. echo '<input type="submit" name="submit" value="Добавить">';
  40. echo '</form>';
  41. }
  42. $komm1 = mysql_query("SELECT * FROM down_comment WHERE id_file = $id ORDER BY id DESC");
  43. $komm = mysql_fetch_array($komm1);
  44. if($komm == null)
  45. {
  46. echo '<div class="posts">Комментрии отсутствуют</div>';
  47. }
  48. else
  49. {
  50. do
  51. {
  52. echo '<div class="posts"><a href="'.DIR_SHCMS.'change_view.php?id='.$komm['user_id'].'">'.$komm['author'].'</a> ('.date('d.m.y',$komm['time']).' в '. date('H:i:s',$komm['time']).') <br/>'.handling_smileys($komm['text']).'';
  53. echo '<span style="float:right;">';
  54. if($user4['team'] == 6)
  55. {
  56. echo '<a href="comment.php?id_del='.$komm['id'].'&delete&id='.$id.'">Удалить</a></span></div>';
  57. }}
  58. while($komm = mysql_fetch_array($komm1));
  59. }
  60.  
  61. if($_POST['submit'])
  62. {$submit = $_POST['submit'];}
  63.  
  64.  
  65. if(isset($submit))
  66. {
  67. if($_POST['text'])
  68. {$text = $_POST['text'];}
  69.  
  70.  
  71. if(empty($text))
  72. {
  73. echo '<div class="errors">Вы не ввели текст сообщения</div>';
  74. header("Refresh: 1; url=?id=$id");
  75. include_once'../template/foot.php';
  76. exit();
  77. }
  78.  
  79. $text_ok = mysql_query("INSERT INTO down_comment (id_file,user_id,author,text,time) VALUES ('$id','$user_id','$user_s[login]','$text','$time_date')");
  80. if($text_ok == true)
  81. {
  82. echo '<div class="actshcms">Ваш комментарий успешно добавлен</div>';
  83. header("Refresh: 1; url=?id=$id");
  84. include_once'../template/foot.php';
  85. exit();
  86. }
  87. else
  88. {
  89. echo '<div class="errors">Ваш комментарий не добавлен</div>';
  90. header("Refresh: 1; url=?id=$id");
  91. include_once'../template/foot.php';
  92. exit();
  93.  
  94. }
  95. }
  96. if(isset($_GET['delete']))
  97. {
  98. if($user4['team'] == 6)
  99. {
  100. if($_GET['id_del'])
  101. {$id_del = $_GET['id_del'];}
  102.  
  103. $del_ok = mysql_query("DELETE FROM down_comment WHERE id=$id_del");
  104. if($del_ok == true)
  105. {
  106. echo '<div class="actshcms">Комментарий успешно удален</div>';
  107. header("Refresh: 1; url=?id=$id");
  108. include_once'../template/foot.php';
  109. exit();
  110. }
  111. else
  112. {
  113. echo '<div class="errors">Комментарий не удален</div>';
  114. header("Refresh: 1; url=?id=$id");
  115. include_once'../template/foot.php';
  116. exit();
  117. }}
  118. }
  119.  
  120.  
  121.  
  122.  
  123. include_once'../template/foot.php';
  124. ?>