do_download.php 770 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. if (!isset($_SERVER['HTTP_REFERER'])) {
  3. $_SERVER['HTTP_REFERER'] = "-";
  4. }
  5. if (!isset($download_file) || !file_exists("distributions/$download_file")) {
  6. exit("Invalid file requested for download!");
  7. }
  8. header("Location: http://$SERVER_NAME/distributions/$download_file");
  9. $remote_addr = $_SERVER['HTTP_X_FORWARDED_FOR'] ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
  10. $remote_log =
  11. @fopen("http://php-gtk.audean.com/log_download.php".
  12. "?download_file=" . urlencode($download_file).
  13. "&mirror=" . urlencode($_SERVER['SERVER_NAME']).
  14. "&user_referer=" . urlencode($_SERVER['HTTP_REFERER']).
  15. "&user_ip=" . urlencode($remote_addr),
  16. 'r');
  17. if ($remote_log) {
  18. fread($remote_log, 1024);
  19. fclose($remote_log);
  20. }
  21. ?>