note 87484 added to function.opendir
| From: | a6april at yahoo dot com | Date: | Sat, 06 Dec 2008 22:03:55 +0000 |
| Subject: | note 87484 added to function.opendir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-147762@lists.php.net to get a copy of this message | ||
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);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 72.79.156.173
----
Manual Page -- http://www.php.net/manual/en/function.opendir.php
Edit -- https://master.php.net/note/edit/87484
Del: integrated -- https://master.php.net/note/delete/87484/integrated
Del: useless -- https://master.php.net/note/delete/87484/useless
Del: bad code -- https://master.php.net/note/delete/87484/bad+code
Del: spam -- https://master.php.net/note/delete/87484/spam
Del: non-english -- https://master.php.net/note/delete/87484/non-english
Del: in docs -- https://master.php.net/note/delete/87484/in+docs
Del: other reasons-- https://master.php.net/note/delete/87484
Reject -- https://master.php.net/note/reject/87484
Search -- https://master.php.net/manage/user-notes.php