Quote:
Originally Posted by Ryan Fait
|
Hi Ryan, thanks for the links, but I'm way out of my depth

, I wouldn't know where to start with the code (the one below for instance). In my naivety I thought there would be a small amount of code I could put into my
html doc. If thats the case with the code below I don't even know where to put the path to the folder?
Regards
Alex
Here we go for a 100% working code...
<?
- PHP: Select all
function cutspaces($str){
*** while(substr($str,0,1)==" "){$str=substr($str,1);}
*** return $str;}
- PHP: Select all
$folders=array();
$files=array();
for($i=0;$i<sizeof($list);$i++){
*** list($permissions,$next)=split(" ",$list[$i],2);
*** list($num,$next)=split(" ",cutspaces($next),2);
*** list($owner,$next)=split(" ",cutspaces($next),2);
*** list($group,$next)=split(" ",cutspaces($next),2);
*** list($size,$next)=split(" ",cutspaces($next),2);
*** list($month,$next)=split(" ",cutspaces($next),2);
*** list($day,$next)=split(" ",cutspaces($next),2);
*** list($year_time,$filename)=split(" ",cutspaces($next),2);
*** if($filename!="." && $filename!=".."){
** * ** if(substr($permissions,0,1)=="d"){
** * * * ** $folders[]=$filename;
** * ** } else {
** * * * ** $files[]=$filename;}}}
sort($folders);
sort($files);
?>
so this will simply "get" all the information WITHOUT being in any case interfered with some spaces, ... etc etc... It will even put files in a $files array and folders in a $folders array, and sort them, so you will be able of using all this later
and: the "folders" will NOT contain "." and ".."
so you can use all this to make a beautiful
FTP interface... later on you could for example put permissions and etc etc in other arrays to use them in your result... cute....