Until then, try this:
<?php
function scandir($dir=".",$sort=0,$type=0) {
if ($sort!==1 && $sort!==0) return "error_sort";
if (is_dir($dir) === FALSE) return "error_dir";
$dirlist = "";
$filelist = "";
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
if (is_dir($file) === TRUE && ($type > 0)) {
$dirlist[] = $file;
if ($sort === 0){
sort($dirlist);
} else {
rsort($dirlist);
}
$scandir["dir"] = $dirlist;
}
if (is_dir($file) === FALSE && $type !== 1) {
$filelist[] = $file;
if ($sort === 0){
sort($filelist);
} else {
rsort($filelist);
}
$scandir["file"] = $filelist;
}
}
}
closedir($handle);
return $scandir;
}
}
//example use:
if (isset($_GET['dir'])) {
$dir = $_GET['dir'];
} else {
$dir = ".";
};
// returns all files in the directory you specify:
$scanfile = scandir($dir,0,0);
// returns all directories in the directory you specify:
$scandir = scandir($dir,0,1);
// returns all files and directories in the directory you specify:
$scanboth = scandir($dir,0,2);
// returns all files in the directory you specify in reverse order:
$scanrev = scandir($dir,1);
?>