fixed the download script to correctly report missing files and does make unneccesary warnings
This commit is contained in:
parent
1e4d84967b
commit
0c8dccd393
1 changed files with 6 additions and 3 deletions
|
@ -1,6 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
function downloadFile($filename) {
|
function downloadFile($filename) {
|
||||||
if (!file_exists($filename)) die('File doesn\'t exist');
|
if (!file_exists($filename)) {
|
||||||
|
header('HTTP/1.0 404 Not Found');
|
||||||
|
//die('File doesn\'t exist');
|
||||||
|
die(1);
|
||||||
|
}
|
||||||
|
|
||||||
$from=0;
|
$from=0;
|
||||||
$cr=NULL;
|
$cr=NULL;
|
||||||
|
@ -67,12 +71,11 @@ function update_count_of_downloads($file) {
|
||||||
|
|
||||||
|
|
||||||
$file = $_GET['file'];
|
$file = $_GET['file'];
|
||||||
$direct = $_GET['direct'];
|
|
||||||
if(!isset($_SERVER['HTTP_RANGE']) ) {
|
if(!isset($_SERVER['HTTP_RANGE']) ) {
|
||||||
update_count_of_downloads($file) ;
|
update_count_of_downloads($file) ;
|
||||||
}
|
}
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
if($direct == 'yes' or !url_exists('http://osmand.googlecode.com/files/'.$file)) {
|
if(isset($_GET['direct']) or !url_exists('http://osmand.googlecode.com/files/'.$file)) {
|
||||||
downloadFile('indexes/'.$file);
|
downloadFile('indexes/'.$file);
|
||||||
} else {
|
} else {
|
||||||
header('HTTP/1.1 302 Found');
|
header('HTTP/1.1 302 Found');
|
||||||
|
|
Loading…
Reference in a new issue