-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmp3.php
More file actions
29 lines (24 loc) · 986 Bytes
/
mp3.php
File metadata and controls
29 lines (24 loc) · 986 Bytes
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
<?php
define('HEADERS', getallheaders());
define('PAGE', 'mp3');
header('Content-Language: en');
require("class.php");
try{
$req = checkReq($_SERVER["REQUEST_METHOD"], $exit, $head_method, null, ['Accept', 'Accept-Error']);
if($exit){ return ''; }
unset($exit); //no wasted memory !
checkAccept(
$req,
(array_key_exists('redirect', $req) && isset($req['redirect']))? strToBool($req['redirect']) : true, //check if the redirect param is true
);
checkParamFile($req);
header("Content-Type: audio/mp3");
header("Content-Location: " . Music::STORAGE_URL . $_GET['file']);
if(!$head_method)
readfile(Music::STORAGE_PATH . '/' . urldecode($_GET["file"]));
}catch(ServerError $err){
return errSrv($err, $head_method);
}catch(Throwable $err){
return errThrow($err, $head_method);
}
?>