readdir and PHP4
| From: | Rodino, Justin Bain | Date: | Mon, 18 Sep 2000 15:13:33 +0000 |
| Subject: | readdir and PHP4 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-17119@lists.php.net to get a copy of this message | ||
We've recently upgraded to PHP4 and now it seems my readdir command isn't
working right. When it tries to read some directories it brings back
extended characters. However, if I parse the PHP file via the command line
it works fine. You can see it happening at:
http://stage.goldendome.com/premier_resources/admin/
Here's the code:
- - - - - - - - - - - - -
<?
$f = opendir("/commonwww/files/foo/admin/");
$fn = readdir($f);
while ($fn) {
$fn = readdir($f);
if ((ereg("\.php$",$fn)) && ($fn != "index.php")) {
$link = eregi_replace("\.php$","",$fn);
$link = eregi_replace("\."," ",$link);
$link = ucfirst($link);
?>
<font size="2" color="#000000"><a href="<? echo $fn
?>"><?echo $link
?></a><br>
<?
}
}
?>
- - - - - - - - - - - - -
Any ideas?
________________________________________
Justin Rodino <justin@goldendome.com>
Web Application Developer
Golden Dome Media
PO Box 1616
Notre Dame, IN 46634
219.631.1116
800.728.7979 ext. 1116
219.631.1001 - fax
http://www.goldendome.com/
http://www.wndu.com/