how to list files in a directory?

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Beta5
-


Joined: 08 Jun 2005
Posts: 13

PostPosted: Fri Jun 17, 2005 9:27 pm    Post subject: how to list files in a directory? Reply with quote

Does anyone have a php script that can list files in a directory?

im looking for something like the one in abyss has, tho i dont want it to just have a white background or something like that, I wanna be able to customize it with my only logo and stuff lol?
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sat Jun 18, 2005 11:39 am    Post subject: Re: how to list files in a directory? Reply with quote

Beta5,

There is a whole chapter in the user's guide of Abyss Web Server that explains how to customize directory listings using simple SSI templates (no programming) or using scripts (in PHP or any language). Basic examples are also there: http://www.aprelium.com/data/doc/2/abyssws-win-doc-html/dirlist.html .
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Beta5
-


Joined: 08 Jun 2005
Posts: 13

PostPosted: Sun Jun 19, 2005 11:53 pm    Post subject: Reply with quote

ok i got the directory list thing working.

but im having a little problem trying to remove one code, everytime i try to change it, the hole thing doesn't show.

If you dont know what im talking about heres a pic,

i have kinda squared the thing that I want to remove in red.


This is the php script
Quote:
<?php
$adir=opendir(str_replace("\\","\\\\",getcwd()));
$dir=str_replace("\\","/",substr(getcwd(),11,strlen(getcwd())))."/";
echo "<table border=0 cellpadding=1 cellspacing=2 width=100% height=><td><b>Name</b></td><td width=70 align=center><b>Size</b></td>";
while (false !== ($arch = readdir($adir))) {
if($arch!='.' && $arch!='index.php'){
echo "<tr><td bgcolor=#F5F5F5><a href=".rawurlencode($arch).">".ucfirst($arch)."</a></td><td bgcolor=#F5F5F5 align=center>";
if (filesize($arch)>0) echo number_format(filesize($arch));
else echo "--";
}
}
echo "</td></table>";
?>
</body>



So ya can someone help me remove that one line in that pic i squared in red?
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Mon Jun 20, 2005 5:40 am    Post subject: Reply with quote

Edit: What I said was completely Off Topic , read Aprelium's reply.

Last edited by TRUSTAbyss on Mon Jun 20, 2005 4:14 pm; edited 1 time in total
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Jun 20, 2005 1:40 pm    Post subject: Reply with quote

Beta5,

Change the line:
Code:

   if($arch!='.' && $arch!='index.php'){


to:

Code:

   if($arch!= '..' && $arch!='.' && $arch!='index.php'){

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Beta5
-


Joined: 08 Jun 2005
Posts: 13

PostPosted: Thu Jun 23, 2005 6:03 pm    Post subject: Reply with quote

aprelium wrote:
Beta5,

Change the line:
Code:

   if($arch!='.' && $arch!='index.php'){


to:

Code:

   if($arch!= '..' && $arch!='.' && $arch!='index.php'){


Thanks again, it works perfectly :)
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group