On Wednesday 04 December 2002 09:41, Stephen wrote: > Nevermind, I fixed it. But now I have another problem. One, my select box > has some sub-directories. How cna I filter those out? It is also showing a > bunch of numbers. I included a screenshot of the select box. The following > is the code: > > <?php > function sortByTime($a, $b) > { > if ($a["time"] == $b["time"]) return 0; > return ($a["time"] < $b["time"]) ? -1 : 1; > } > if($handle = opendir('/Inetpub/wwwroot/checker/modules/')) > { > while (false != ($file = readdir($handle))) > { > if ($file != "." && $file != "..")
To filter out directories add an extra check here using is_dir(). > $files[] = array("file" => $file, "time" => > filectime("/Inetpub/wwwroot/checker/modules/".$file)); > } Your "bunch of numbers" is the file creation date and originates from the above and assigned to your <SELECT> box further down. > usort($files, "sortBytime"); > > echo "<select>"; > while (list(,$filearr) = each($files)) > { > echo "<option > value=\"".$filearr["file"]."\">".$filearr["file"]."".$filearr["time"]; > } > echo "</select>"; > } > ?> It's all very well asking for help and receiving some code in return. You have to take some time out to understand what the code is actually doing instead of just blindly using it. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* I have always noticed that whenever a radical takes to Imperialism, he catches it in a very acute form. -- Winston Churchill, 1903 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php