Просмотр файла panel/del_comm.php

Размер файла: 2.26Kb
  1. <?php
  2. define('_WBLIB',1);
  3. require_once ('../inc/core.php');
  4. if ($level < 1) {exit('Доступ закрыт');}
  5.  
  6. // Заголовки
  7. $title = 'Удаление комментария';
  8. require_once ('../inc/head.php');
  9. #################################
  10.  
  11. $act = isset($_GET['act']) ? $_GET['act'] : '';
  12.  
  13. if ($act == 'all') {
  14. $req = mysql_query("SELECT * FROM `article` WHERE `id` = '$id' AND `type` = '2' LIMIT 1");
  15. if (!mysql_num_rows($req)) {
  16. exit('Статья не найдена');
  17. require_once ('../inc/foot.php');
  18. exit();
  19. }
  20. $res = mysql_fetch_assoc($req);
  21. if (isset($_GET['yes'])) {
  22. $result = mysql_query("DELETE FROM `comm` WHERE `id_article` = '$id'");
  23. if ($result) header("Location: $home/comm.php?id=".$id."");
  24. else exit('<div class="error">Ошибка удаления всех комментариев . Код ошибки :'.mysql_error().'</div>');
  25. }
  26. else {
  27.  
  28. echo '<div class="link"><div class="error">Вы действительно хотите кдалить все комментарии к данной статье ?<br /> <a href="del_comm.php?act=all&amp;id=' . $id . '&amp;yes">Удалить</a> | <a href="/comm.php?id=' .$id. '">Отмена</a></div></div>';
  29. }
  30. }
  31. else {
  32. $req = mysql_query("SELECT * FROM `comm` WHERE `id` = '$id' LIMIT 1");
  33. if (!mysql_num_rows($req)) {
  34. exit('Комментарий не найден');
  35. require_once ('../inc/foot.php');
  36. exit();
  37. }
  38. $res = mysql_fetch_assoc($req);
  39. if (isset($_GET['yes'])) {
  40. $result = mysql_query("DELETE FROM `comm` WHERE `id` = '$id'");
  41. if ($result) header("Location: $home/comm.php?id=".$res['id_article']."");
  42. else exit('<div class="error">Ошибка удаления комментария . Код ошибки :'.mysql_error().'</div>');
  43. }
  44. else {
  45.  
  46. echo '<div class="link"><div class="error">Вы действительно хотите удалить комментарий ?<br /> <a href="del_comm.php?id=' . $id . '&amp;yes">Удалить</a> | <a href="/comm.php?id=' .$res['id_article']. '">Отмена</a></div></div>';
  47. }
  48. }
  49. echo '<div class="func"><a href="/index.php">Главная</a></div>';
  50. require_once ('../inc/foot.php');
  51. ?>