I am having a weird problem with a simple file listing on one of my client's host.


My code works perfectly on my host, but if i use the same code on his, it only lists certain types of files. Heres the code: (i hate hosts that only allow php inside the cgi-bin dir, its crazy to code like this)

#!/usr/local/bin/php
<?
$count = 0;
$handle=opendir("/whu1/sites/op158006/public_html/clientes/adagio/");
while (($file = readdir($handle)) !== false) {
        if ($file == "." || $file == ".." || $file == "list.php") {
        } else {
                if (filetype($file) == "file") {
                        $size= filesize($file)/1000;
                        print "$file ($size KB)<br>";
                        $count ++;
                }
        }
}
closedir($handle);
print "> <b>$count</b> Ficheiro(s)<br>";
?>

This hoster only allows PHP inside the cgi-bin directory. And i can only list files properly if i list that dir (cgi-bin). I.E. if i use:

        $handle=opendir("/whu1/sites/op158006/cgi-bin/");

it lists the dir perfectly, with images or whatever it might have in there. But if i try to list somje other dir outside the cgi-bin scope list comes out only with .txt and .php type of files, if i have an image in there it simply ignores it.
Why does this happen? Its so frustrating!


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to