-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdl_file.php
28 lines (21 loc) · 832 Bytes
/
dl_file.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
<?php
include_once 'includes.php';
$id = isset($_GET['id']) ? filter($_GET['id']) : -1;
$filename = isset($_GET['filename']) ? $_GET['filename'] : "unknown.srt";
$sql = $db->query("SELECT sha1, size FROM files WHERE id = '{$id}'");
$file = mysql_fetch_assoc($sql);
if ( $file ) {
$file_path = $config['folder_uploads'].$file['sha1'].".gz";
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Pragma: public");
header("Content-Description: File Transfer");
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=\"".$filename."\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".$file['size']."");
@readgzfile($file_path);
}
else {
header("location:../../index.php");
}