explode url id downs DB run queryFetch SELECT FROM downs WHERE url LIM

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
$u = explode('_', $url);
$id = $u[0];
$downs = DB::run() -> queryFetch("SELECT * FROM downs WHERE url=? LIMIT 1;", array($url));
$file = "files/".$downs['downs_link'];
DB::run() -> query("UPDATE downs SET url=? WHERE downs_id=?", array(NULL, $id));
$name = basename($file);
header('Content-Type: application/octet-stream');
header('Content-disposition: filename="'.$name);
readfile($file);