cancel
Showing results for 
Search instead for 
Did you mean: 

Script not working on new ccgi server.

Marteknet
Grafter
Posts: 577
Registered: 13-10-2007

Script not working on new ccgi server.

I have a webspace usage reporting script running on the old cgi server, the results diplay on my desktop, it's been running without any problem at all for months, but gives a error when run on the new ccgi server. here's the subroutine that's now failing.

function listDir($dir,$ftp)
{
global $used;
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
{
$used = $used + CEIL($matches[3]);
}
echo " "; flush();
}
}

Has anyone any idea why it should new return an error saying
Quote
Warning: Invalid argument supplied for foreach() in ******************.php on line 60

I can't quite get my head round this, please help.
1 REPLY
N/A

Script not working on new ccgi server.

Sounds like the connection to FTP failed, and you're trying to loop round a variable thats not defined /has any data.