|
//set the HTTP path to your directory
$http_path = $_SERVER['PHP_SELF']."?name=";
$http_path = ereg_replace ("sets/", "", $http_path);
//set the server path to your directory, add trailing /
$dir_path = $_SERVER['DOCUMENT_ROOT'].'/fiddle/';
//open directory
if($handle = @opendir("$dir_path"))
{
$count= 0;
//read through each file
while (false !== ($files = readdir($handle)))
{
//exclude file types
if(($files != ".") && ($files != "..") && (!preg_match("/\b_/i", "$files")) && (!preg_match("/\bindex/i", "$files")) && (!preg_match("/\bblank/i", "$files")) && (!preg_match("/\bfiddles/i", "$files")) && (!preg_match("/\bhtml/i", "$files")) && (!preg_match("/\bmp3.php/i", "$files")) && (!preg_match("/\bfiles/i", "$files")) && (!preg_match("/\bimager/i", "$files")))
{
//build array from resulting files
$files = ereg_replace ("manicdiary-", "", $files);
$file_array["$count"]=$files;
$count++;
}
}
//sort the array alphabetically
asort($file_array);
//spit our each file
foreach($file_array as $file)
{
$name = $file = ereg_replace (".php", "", $file);
$name = ereg_replace ("_", " ", $file);
//output file link
?>
}
}
?> |
 |