Newsgroup: it.comp.www.php
Titolo: Opendir problem

I tried to use this code (filename is entry.php3):
<?php
$path=dirname($SCRIPT_FILENAME);
echo "$path \n";
chdir($path);
$main=opendir($path);
echo "Directory handle: $main\n";
echo "<br>Files:\n";
while (($file = readdir($main))!==false) {
if ($file != "." && $file != "..") { 
        $filesplit = split("\.", chop($file));
		echo "$filesplit[0]\n"; 
    } 
}
closedir($main); 
?>
but I have the following error:
/home/mfo/spada/public_html/phpbib Directory handle: 1 
Files: 
Parse error: parse error in /home/mfo/spada/public_html/phpbib/entry.php3 on
line 8
Trying to solve permission problem, I've set
drwxrwxrwx   5 spada    mfo         8192 Oct  8 12:32 phpbib/
and the files in the dir:
ll phpbib/
total 46
-rw-r--r--   1 spada    mfo           64 Sep  4 17:46 article.txt
-rw-r--r--   1 spada    mfo           95 Sep  4 17:46 book.txt
-rw-r--r--   1 spada    mfo           56 Sep  4 17:46 booklet.txt
-rw-r--r--   1 spada    mfo          116 Sep  4 17:46 conference.txt
-rw-r--r--   1 spada    mfo          332 Oct  8 12:19 entry.php3
-rw-r--r--   1 spada    mfo          115 Sep  4 17:46 inbook.txt
-rw-r--r--   1 spada    mfo          127 Sep  4 17:46 incollection.txt
-rw-r--r--   1 spada    mfo          116 Sep  4 17:46 inproceedings.txt
-rw-r--r--   1 spada    mfo           64 Sep  4 17:46 manual.txt
-rw-r--r--   1 spada    mfo           55 Sep  4 17:46 mastersthesis.txt
-rw-r--r--   1 spada    mfo           46 Sep  4 17:46 misc.txt
-rw-r--r--   1 spada    mfo           55 Sep  4 17:46 phdthesis.txt
-rw-r--r--   1 spada    mfo           90 Sep  4 17:46 proceedings.txt
-rw-r--r--   1 spada    mfo           68 Sep  4 17:46 techreport.txt
-rw-r--r--   1 spada    mfo           32 Sep  4 17:46 unpublished.txt
I' using:
PHP 3.0.15
Compaq Tru64 UNIX V5.0A (Rev. 1094)
The same code works on my win PC!!
Thankx 4 any help
se@n
-- 
Posted from 
hst35252.phys.uu.nl
 [131.211.35.252] 
via Mailgate.ORG Server - 
http://www.Mailgate.ORG

Scusate per la mail in inglese, ma mi sono accorto troppo tardi che era un
newsgroup it.
Ho provato ad usare questo codice x leggere e listare 
i nomi dei file di una dir (nome del file: entry.php3):
<?php
$path=dirname($SCRIPT_FILENAME);
echo "$path \n";
chdir($path);
$main=opendir($path);
echo "Directory handle: $main\n";
echo "<br>Files:\n";
while (($file = readdir($main))!==false) {
if ($file != "." && $file != "..") { 
        $filesplit = split("\.", chop($file));
		echo "$filesplit[0]\n"; 
    } 
}
closedir($main); 
?>
ma mi da' il seg errore:
/home/mfo/spada/public_html/phpbib Directory handle: 1 
Files: 
Parse error: parse error in /home/mfo/spada/public_html/phpbib/entry.php3 on
line 8
Per vedere se erano problemi di permessi ho settato la dir con chmod 777 !!
drwxrwxrwx   5 spada    mfo         8192 Oct  8 12:32 phpbib/
questi sono i files che ho nella dir in questione:
ll phpbib/
total 46
-rw-r--r--   1 spada    mfo           64 Sep  4 17:46 article.txt
-rw-r--r--   1 spada    mfo           95 Sep  4 17:46 book.txt
-rw-r--r--   1 spada    mfo           56 Sep  4 17:46 booklet.txt
-rw-r--r--   1 spada    mfo          116 Sep  4 17:46 conference.txt
-rw-r--r--   1 spada    mfo          332 Oct  8 12:19 entry.php3
-rw-r--r--   1 spada    mfo          115 Sep  4 17:46 inbook.txt
-rw-r--r--   1 spada    mfo          127 Sep  4 17:46 incollection.txt
-rw-r--r--   1 spada    mfo          116 Sep  4 17:46 inproceedings.txt
-rw-r--r--   1 spada    mfo           64 Sep  4 17:46 manual.txt
-rw-r--r--   1 spada    mfo           55 Sep  4 17:46 mastersthesis.txt
-rw-r--r--   1 spada    mfo           46 Sep  4 17:46 misc.txt
-rw-r--r--   1 spada    mfo           55 Sep  4 17:46 phdthesis.txt
-rw-r--r--   1 spada    mfo           90 Sep  4 17:46 proceedings.txt
-rw-r--r--   1 spada    mfo           68 Sep  4 17:46 techreport.txt
-rw-r--r--   1 spada    mfo           32 Sep  4 17:46 unpublished.txt
Lavoro con:
PHP 3.0.15
Compaq Tru64 UNIX V5.0A (Rev. 1094)
Il codice funziona bene sul mio PC con winME!!
Grazie
