Just put this in any directory as index.php and it will display all and only the mp3 files in that directory.
By : sliver
<TABLE ALIGN=CENTER BGCOLOR=#ffffff CELLPADDING=4 CELLSPACING=0 BORDER=2> <tr><TH>File</TH><TH>Size</TH></TR> <?php /*code created by Sliver sliver85@gmail.com This program is freeware, but please leave my name on it.*/ $dir="./"; if (is_dir($dir)) { $fd = @opendir($dir); while (($part = @readdir($fd)) == true) { if ($part != "." && $part != "..") { $file_array[]=$part; } } if ($fd == true) { closedir($fd); } } sort($file_array); reset($file_array); for($i=0;$i<count($file_array);$i++) { $npart=$file_array[$i]; if (strstr($npart,".mp3")) { $name=str_replace(".mp3","",$npart); $fsize=filesize($npart)/1000; print("<tr><td><a href=\"$npart\">$name</a>"); print("<td>$fsize</td></tr>"); } } ?></table>
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.