proxy.php 976 B

12345678910111213141516171819202122
  1. <?php
  2. // by 请勿倒卖,已申请软著,否则追究法律责任
  3. include "../../../system/db.class.php";
  4. db("salt")->where("in_time", "<", strtotime("-60 seconds"))->delete();
  5. $proxy = explode("/", isset($_SERVER["PATH_INFO"]) ? $_SERVER["PATH_INFO"] : NULL);
  6. $base = isset($proxy[1]) ? $proxy[1] : NULL;
  7. $salt = SafeSql(str_replace(array(".ipa", ".apk"), array("", ""), $base));
  8. $id = db("salt")->where("in_salt", $salt)->value("in_aid");
  9. $id || exit("Access denied");
  10. $app = db("appid")->where("in_id", $id)->find();
  11. $size = filesize(IN_ROOT . "./data/attachment/" . $app["in_app"]);
  12. header("Cache-Control: private");
  13. header("Content-Type: application/octet-stream");
  14. header("Content-Disposition: attachment; filename=" . $app["in_originalName"]);
  15. header("Content-Transfer-Encoding:binary");
  16. header("Accept-Ranges: bytes");
  17. header("Expires:0");
  18. header("Cache-Control:must-revalidate");
  19. header("Pragma:public");
  20. header("Content-Length: " . $size);
  21. readfile(getapp($id, 1));