RE: Directory Listing with PHP

From: Date: Thu, 01 Feb 2001 13:16:24 +0000
Subject: RE: Directory Listing with PHP
Groups: php.general 
Request: Send a blank email to php-general+get-37629@lists.php.net to get a copy of this message
don't know what apache does but this will give you everything below the pathn you pass in. function sitemap($ddPath) { $dhandle = opendir($ddPath); echo("<ul>"); while ($ddFile = readdir($dhandle)) { if ($ddFile == "." or $ddFile == "..") continue; // trap . and .. echo("<li>".$ddFile . "</li>"); if (is_dir($ddPath . $ddFile)) sitemap($ddPath . $ddFile . "/"); }; closedir($dhandle); echo("</ul>"); }; Tim Ward Senior Systems Engineer Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html > -----Original Message----- > From: Chris Aitken [mailto:chris@ideal.net.au] > Sent: 01 February 2001 05:05 > To: PHP User Group > Subject: Directory Listing with PHP > > > > > (Damn I hate it when I forget to change the subject) > > > Does anyone have, or know of a script which simulates what > Apache gives out > when it shows the entire contents of a directory ? > > I find it very handy to use the directory listing of say graphics > directories and the like, but I dont want others looking into them. > > What I thought would be a good system is to have an index.php > file which > asks for a password. If the password is accepted, it shoots > them off to a > php script which displays the contents of the DIR just as > apache would. > > This way I can bar viewing of the directories contents, only > viewable to > the owners of the password. > > > Ive seen a couple of scripts which claim to show the > directory listing, but > none of them seem to work any good with a decent layout and > amount of file > info. So im looking for a script which can display the > listing properly. > Does one exist, or am I just relieving myself into the wind ? > > > Thanks > > Chris > > -- > Chris Aitken - Webmaster/Database Designer - IDEAL Internet > email: chris@ideal.net.au phone: +61 2 4628 8888 fax: +61 2 > 4628 8890 > -------------------------------------------- > > Unix -- because a computer's a terrible thing to waste! > >

« previous php.general (#37629) next »