diff options
-rwxr-xr-x | includes/inc_media.php | 6 | ||||
-rw-r--r-- | streammusic.php | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/includes/inc_media.php b/includes/inc_media.php index 7c5f133..b871a42 100755 --- a/includes/inc_media.php +++ b/includes/inc_media.php @@ -91,6 +91,12 @@ else print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$dir}{$value}\" />"; print "</form>\r\n"; } + else if ( preg_match("'" .$fileext ." '", $audiotypes) + || preg_match("'" .$fileext ." $'", $audiotypes) + ) + { + print "<li class=\"menu\"><a href=\"streammusic.php?file={$dir}{$value}\"><img src=\"images/pictos/audio.png\" /><span class=\"name\">$value</span><span class=\"arrow\"></span></a></li>\r\n"; + } } } } diff --git a/streammusic.php b/streammusic.php new file mode 100644 index 0000000..e1170f7 --- /dev/null +++ b/streammusic.php @@ -0,0 +1,14 @@ +<?php +//set headers to mp3 +$file = $_GET['file']; +header("Content-Transfer-Encoding: binary"); +header("Content-Type: audio/mp3"); +header('Content-length: ' . filesize($file)); +header('Content-Disposition: attachment; filename="track.mp3"'); +header('X-Pad: avoid browser bug'); +Header('Cache-Control: no-cache'); + +readfile($file); +die(); + +?> |