diff options
author | Alib <aliboba@free.fr> | 2010-02-24 10:22:43 +0100 |
---|---|---|
committer | Alib <aliboba@free.fr> | 2010-02-24 10:22:43 +0100 |
commit | f254a8b5816384da1fa7a3bb639232ecec582014 (patch) | |
tree | a253ad361c722db83dcbcdc58d6f08a44cb45c51 | |
parent | 88503d0f3a5e3724606754ecd8d4d109973e0d47 (diff) | |
download | istreamdev-f254a8b5816384da1fa7a3bb639232ecec582014.tar.gz istreamdev-f254a8b5816384da1fa7a3bb639232ecec582014.tar.bz2 |
first try for mp3 streaming. Works but not secure at all.
-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(); + +?> |