forked from kidino/simple-ipn
/
dl.php
56 lines (43 loc) · 1.26 KB
/
dl.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
set_time_limit(0);
include('settings.php');
include('functions.php');
include_once('downloader.inc.php');
$no_files = array(
"index.php",
"ipn.php",
"dl.php",
"page.php",
"settings.php",
"functions.php"
);
$txn_id = preg_replace("/[^0-9a-zA-Z]/", "", $_GET['id']);
$customer_file = basename($txn_id.'.php');
if (in_array($customer_file, $no_files)) {
die('<h1>FATAL ERROR: Unauthorized Access</h1>');
}
if (file_exists($customer_file))
{ include($customer_file); }
else
{ die('Purchase Details Not Found. Contact Administrator.'); }
if ($_GET['file'] == '')
{ die('Invalid File Information. Contact Administrator.'); }
$file_id = (int) $_GET['file'];
if (!isset($product_files[$file_id]))
{ die('Invalid File Information. Contact Administrator.'); }
$file = $product_files[$file_id];
if (download_is_expired($customer_info['expire_date']))
{ die('Download has expired.'); }
if (file_exists($file['source']))
{
$download = new downloader();
$download->set_byfile($file['source']);
$download->mime = '';
$download->use_resume = true; //Enable Resume Mode
$download->filename = $file['filename'];
$download->download();
exit();
}
else
{ die("Download file ID $file_id is not valid. Please contact webmaster."); }
?>