Here is my PHPCommander <1000bytes
<?php
var_dump($HTTP_POST_VARS);
if (@!$HTTP_POST_VARS['dir']) $HTTP_POST_VARS['dir']='./';
if (is_dir($HTTP_POST_VARS['dir'])){
echo '<form method="post" action="'.$PHP_SELF.'" name="ok">';
echo "<input type='hidden' name='dir' value='".$HTTP_POST_VARS['dir']."'></form>";
if ($dir = @opendir($HTTP_POST_VARS['dir'].'/')) {
while($file = readdir($dir)) {
if (is_file($HTTP_POST_VARS['dir']."/$file")){
$fsize=filesize($HTTP_POST_VARS['dir']."/$file");
}else{
$fsize=0;
}
printf("<pre>%120s,%10d</pre><br>\n","<a
href='javascript:document.ok.elements[\"dir\"].value=\"".$HTTP_POST_VARS['dir']."/".$file."\";document.ok.submit();'>$file</a>",$fsi
ze);
}
closedir($dir);
}
}else{
echo "<a href=\"javascript:history.go(-1);\">Back</a><br><br>";
$ar=file($HTTP_POST_VARS['dir']);
while (list($k,$v)=each($ar)){
$ln+=strlen($v);
if ($ln>0){
echo htmlspecialchars($v)."<br>\n";
}
}
}
?>
Enjoy
Andrey Hristov
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, November 28, 2001 1:38 PM
Subject: RE: [PHP] Directory Contents Listing
> Here's an example code I use
>
> <?
> // print the current directory in unordered list
> print("<UL>\n");
>
> // get each entry within the directory & return to user with the
> link
> $myDirectory = dir(".");
> while($entryName = $myDirectory->read())
> {
> if ($entryName != "." && $entryName != ".." && $entryName !=
> "index.php"){
> print("<LI><a href=$entryName>$entryName \n</a>");
> }
> }
> ?>
>
> Hope it helps!
>
> -----Original Message-----
> From: Steve Werby [mailto:[EMAIL PROTECTED]]
> Sent: 28 November 2001 05:39
> To: Deependra B. Tandukar; [EMAIL PROTECTED]
> Subject: Re: [PHP] Directory Contents Listing
>
>
> "Deependra B. Tandukar" <[EMAIL PROTECTED]> wrote:
> > How do I display the directory contents using PHP?
>
> See readdir() in the online manual. I'm pretty sure it even has example
> code you could paste in.
>
> --
> Steve Werby
> President, Befriend Internet Services LLC
> http://www.befriend.com/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]