note 15059 deleted from ref.dir by jimw
| From: | jimw@php.net | Date: | Wed, 02 Jan 2002 12:19:06 +0000 |
| Subject: | note 15059 deleted from ref.dir by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-24272@lists.php.net to get a copy of this message | ||
<?
/*Here is a little ditty I wrote in the beta development of a web based admin interface for my site,
badhit.com. It lists selected files in a directory, and I hope that it can help someone else. I
really like to properly nest all of my code, but this page doesn't like the spaces or tabs I
tried to use. */
function list_dir_contents()
{
$handle=opendir('.');
/*This array holds patterns to try to match using a regular expression match. If a file name
contains any of these words, the filename will not be shown in the output. Do **NOT** use
'.'! */
$words = array("do", "test", "all", "add",
"update", "login", "index");
$MAXX = count($words);
$I = 0;
$J = 0;
/*Here is the real meat and potatoes. */
while($file_s = readdir($handle)){
while(($J < 1) && ($I < $MAXX)){
if(eregi($words[$I], $file_s))
$J++;
$I++;
}
if($J < 1) /*echo a hyperlink to the file */
echo "<A href=$file_s>$file_s</a><BR>";
$I = 0;
$J = 0;
}
closedir($handle);
}
?>