note 87484 rejected from function.opendir by danbrown
| From: | danbrown@php.net | Date: | Sat, 06 Dec 2008 22:15:23 +0000 |
| Subject: | note 87484 rejected from function.opendir by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147773@lists.php.net to get a copy of this message | ||
Note Submitter: a6april at yahoo dot com
----
I am listing the files in an open directory but was wondering if anyone knew how to hide certain
files, such as:
error_log
.htaccess
index.html
or any other file I want to be NOT listed.
here is the code I am using:
<br><br>
<?php
$path = "/home/ctech/public_html/bryan";
$dh = opendir($path);
$i=1;
while (($file = readdir($dh)) !== false) {
if($file != "." && $file != "..") {
echo "$i. <a target=_blank href='$file'>$file</a><br
/>";
$i++;
}
}
closedir($dh);
?>