note 37100 added to function.readdir

From: Date: Mon, 03 Nov 2003 10:46:11 +0000
Subject: note 37100 added to function.readdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-59679@lists.php.net to get a copy of this message
Simple script to read mp3-files in Apples iTunes-Directories. Just put it as index.php in every directory. <?php function getFiles() { $handle=opendir('.'); $host=getenv("HTTP_HOST"); echo "<a href='http://$host'>$host</a>"; $pfad = str_replace("%20"," ",getenv("REQUEST_URI")); list($x,$interpret,$album) = explode("/",$pfad); if ($interpret) { echo "/<a href='http://$host/$interpret'>$interpret</a>/"; } if ($album) { echo "<a href='http://$host/$interpret/$album'>$album</a>"; } echo "<br><br>"; while (false !== ($file = readdir ($handle))) { if ($file != "index.php" AND $file != "." AND $file != ".." AND $file != ".htaccess") { if (strstr($file,".") == ".mp3") { echo "- <a href='$file' target='_blank'>$file</a><br>"; } else{ echo "<a href='$file'>$file</a><br>"; } } } closedir($handle); } getFiles(); ?> ---- Manual Page -- http://www.php.net/manual/en/function.readdir.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37100 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37100&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37100&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59679) next »