You are here: protected too much! « PHP « IT news, forums, messages
protected too much!

Posted by Miguel Vaz on 05/13/05 05:05

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!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация