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

Размер файла: 984B
  1. <?php
  2.  
  3. $sql->query("SELECT * FROM `down_files` WHERE `id` = '$id' AND (`type` = 2 OR `type` = 3) LIMIT 1");
  4. $res_down = $sql->fetch();
  5. if (!is_file($res_down['dir'] . '/' . $res_down['name']) || ($res_down['type'] == 3 && !$admin)) {
  6. $error = true;
  7. }
  8. else {
  9. $link = $res_down['dir'] . '/' . $res_down['name'];
  10. }
  11. $more = isset($_GET['more']) ? abs(intval($_GET['more'])) : false;
  12. if ($more) {
  13. $sql->query("SELECT * FROM `down_more` WHERE `refid` = '$id' AND `id` = '$more' LIMIT 1");
  14. $res_more = $sql->fetch();
  15. if (!is_file($res_down['dir'] . '/' . $res_more['name'])) {
  16. $error = true;
  17. }
  18. else {
  19. $link = $res_down['dir'] . '/' . $res_more['name'];
  20. }
  21. }
  22. if ($error) {
  23. header('location: ../?err');
  24. }
  25. else {
  26. if (!isset($_SESSION['down_' . $id]))
  27. $sql->query("UPDATE `down_files` SET `field`=`field`+1 WHERE `id`='$id'", true);
  28. $_SESSION['down_' . $id] = 1;
  29. header('location: ' . $link);
  30. }