Просмотр файла mod.php

Размер файла: 2.66Kb
  1. <?php
  2.  
  3. define('_IN_JOHNCMS', 1);
  4.  
  5. $headmod = 'lib';
  6. $textl = 'Библиотека';
  7. require_once ("../incfiles/core.php");
  8. require_once ("./inc/conf.php");
  9. $textl = 'Модерация статей';
  10. require_once ("../incfiles/head.php");
  11. if($rights == 5 || $rights >= 6)
  12. {
  13. if(isset($_GET['error_pot']))
  14. {
  15. echo '<div class="">ОШИБКА!!!</div>';
  16. }
  17. if(isset($_GET['error_del']))
  18. {
  19. echo '<div class="">ОШИБКА!!!</div>';
  20. }
  21. $sql = mysql_query("select * from `library` where `moder` = '0' and `type` = 'file' order by `name` ASC, `file` ASC LIMIT ".$start.",".$kol_file."");
  22. $total = mysql_result(mysql_query("select COUNT(*) from `library` where `moder` = '0' and `type` = 'file'"),0);
  23. if($total > 0)
  24. {
  25. while($res = mysql_fetch_array($sql))
  26. {
  27. echo '<div class="list1">';
  28. echo '&deg;<img src="./img/page_white_text.png" alt="" /><a href="read.php?id='.$res['id'].'">'.$res['name'].'</a><br/>';
  29. $user = mysql_fetch_array(mysql_query("select `name` from `users` where `id` = '".$res['id_avtor']."' LIMIT 1"));
  30. echo '<ul>';
  31. echo '<li><strong>Добавил:</strong>'.$user['name'].'<br/></li>';
  32. $ee = mysql_fetch_array(mysql_query("select `name` from `library` where `id` = '".$res['fid']."'"));
  33. echo '<li>Раздел: [<a href="index.php?id='.$res['fid'].'">'.$ee['name'].'</a>]<br/></li>';
  34. echo '</ul>';
  35. echo '[<a href="mod.php?act=pot&amp;id='.$res['id'].'">Потвердить</a>]|[<a href="mod.php?act=del&amp;id='.$res['id'].'">Удалить</a>]';
  36. echo '</div>';
  37. }
  38. // Постраничная навигация
  39. if ($total > $kmess) {
  40. echo '<p>' . pagenav('mod.php?', $start, $total, $kol_file) . '</p>';
  41. }
  42. if($act == 'pot')
  43. {
  44. if(!empty($id))
  45. {
  46. if(mysql_query("update `library` set `moder` = '1' where `id` = '".$id."' LIMIT 1"))
  47. {
  48. header("Location: mod.php?");
  49. }else{
  50. header("Location: mod.php?error_pot");
  51. }
  52. }else{
  53. header("Location: mod.php?error_pot");
  54. }
  55. }
  56. if($act == 'del')
  57. {
  58. if(!empty($id))
  59. {
  60. if(mysql_query("DELETE FROM `library` WHERE `id` = '".$id."' LIMIT 1"))
  61. {
  62. header("Location: mod.php?");
  63. }else{
  64. header("Location: mod.php?error_del");
  65. }
  66. }else{
  67. header("Location: mod.php?error_del");
  68. }
  69. }
  70. }else{
  71. echo 'Нет статей для модерации!!!<br/>';
  72. echo '<a href="index.php?">Назад</a>';
  73. }
  74. }
  75. require_once ('../incfiles/end.php');
  76. ?>