'; //echo ''.$audio.'
'; } else { $file = str_replace('.mpg', '', $file); $file = str_replace('.mpeg', '', $file); $file = str_replace('.aiff', '', $file); echo $file.'
'; } } else { if (!empty($artist)) { $albumInfo = '&album='.$file; $artistInfo = $artist; } else { $artistInfo = $file; } echo ''.$file.'
'; } } } } } } function playMusic($artist, $album, $song, $mainDir) { $dir = $mainDir.$artist."/".$album."/"; $file = $song; echo $dir.$file; if ($contents = file_get_contents($dir.$file)) { header("Content-type: audio/mpeg"); die($contents); } } $artist = $_GET['artist']; $album = $_GET['album']; $song = $_GET['song']; if (strstr($artist, "..")) die('No ".." please.'); if (strstr($album, "..")) die('No ".." please.'); $mainDir = "/Volumes/Firefly/iTunes Music/"; if (!empty($artist) && !empty($album) && !empty($song)) { //playMusic($artist, $album, $song, $mainDir); die("Playing music is currently incomplete"); } else { findMusic($artist, $album, $mainDir); } ?>