All pastes #118005 Raw Edit

Untitled

public php v1 · immutable
·published 2006-08-06 05:02 UTC
rendered paste body
<?php/*Hi Guys ! thanks for downloading this script. It's a little addon for myFlash MP3 Player that scans a directory for mp3 files and automaticallycreates the corresponding playlist. Just throw it in the same dir as yourmp3player.swf file and, just below here, set the directory to scan for.The default setup supposes you have your mp3 files in the "mp3/" subdir.Next, in your mp3player.html file, give the mp3 player the playlist parameterthat points to this script, playlist.php:  <object type="application/x-shockwave-flash" width="280" height="280"    data="mp3player.swf?playlist=playlist.php">  <param name="movie" value="mp3player.swf?playlist=playlist.php" />  </object>Good luck !*/// setting the directory to search for mp3 files$dir = "./mp3";// reading the directory and inserting the mp3 files in the playlist array$n = 0;$playlist = array();$fdir = opendir($dir);while($i = readdir($fdir)) {   // if a .mp3 string is found, add the file to the array   if (strpos(strtolower($i),".mp3") !== false) {  	   $playlist[$n] = $i;  	   $n++;  	}}// close the directory and sort the arrayclosedir($fdir);array_multisort($playlist);// echoing the playlist to flashecho "<player showDisplay=\"yes\" showPlaylist=\"yes\" autoStart=\"yes\">\n";for ($i=0; $i<sizeof($playlist); $i++) {   // for the title it filters the directory and the .mp3 extension out   echo "  <song path=\"$dir$playlist[$i]\" title=\"".str_replace(".mp3","",$playlist[$i])."\" />\n";}echo "</player>";?>