Hi all, I need a directory lister for my site... it would be best if the lister can actually connect to the FTP!
I have a code but it doesnt suit me much because it doesnt show me FILE SIZE and TIME STAMP
Here's the code:
PHP Code:
<?php
$ip = 'ftp.domain.com';
$user = 'access[at]domain.com';
$pass = 'password';
$port = '21';
$path = "";
function listDir($dir,$ftp)
{
echo $dir;
ftp_pasv($ftp,true);
ftp_chdir($ftp,$dir);
$list = ftp_rawlist($ftp,".");
foreach($list as $item)
{
ereg("([-d])([rwxst-]{9}).* ([0-9]*) ([a-zA-Z]+[0-9: ]* [0-9]{2}:?[0-9]{2}) (.+)", $item, $matches);
if ($matches[1] == 'd')
{
listDir($dir.'/'.$matches[5],$ftp);
}
else
{
echo '<dd>'.$matches[5].'</dd>';
}
flush();
}
}
$ftp = ftp_connect($ip,$port);
ftp_login($ftp,$user,$pass);
echo '<dl>';
listDir($path,$ftp);
echo '</dl>';
?>
Thank you in advance