Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function randMp3(){
- $mp3 = glob('*.mp3', GLOB_BRACE);
- return $mp3[array_rand($mp3)];
- }
- $extension = "mp3";
- $mime_type = "audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3";
- $file = randMp3();
- if(file_exists($file)){
- header('Content-type: {$mime_type}');
- header('Content-length: ' . filesize($file));
- header('Content-Disposition: filename="' . $filename);
- header('X-Pad: avoid browser bug');
- header('Cache-Control: no-cache');
- readfile($file);
- }else{
- header("HTTP/1.0 404 Not Found");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement