Hello, I found this code earlier on, however, it causes an error with the }. The error is:
Parse error: parse error, unexpected '{' ... on line 19
The line of code is:
if ($currdir=@opendir($path."/".$dirlist[$i])
{
The full code if necessary is below. Just curious what to do, if I remove it, more errors follow. It's something for the future that I am sure would help me, not just with this script.
thanks
######### Code
$path = "./";
if ($maindir = @opendir($path)) // OPEN THE TOP LEVEL
{
while ($subdir = readdir($maindir))
{
if ($subdir!='.' && $subdir!='..' && is_dir($maindir."/".$subdir))
{ $dirlist[sizeof($dirlist)]=$subdir; }
}
closedir($maindir);
// RUN THROUGH THE DIRLIST ARRAY AND GET FILES
sort($dirlist);
for($i=0; $i<sizeof($dirlist); $i++)
{
if ($currdir=@opendir($path."/".$dirlist[$i])
{
while ($file = readdir($currdir))
{
if ($file!='.' && $file!='..' && is_file($path."/".$dirlist[$i]."/".$file))
{ $filelist[sizeof($filelist)]=$file; }
}
sort($filelist);
echo $dirlist[$i]."<BR>\n";
for($i=0; $i<sizeof($filelist); $i++)
{ echo "->".$filelist[$i]."<BR>\n"; }
echo "<BR>\n";
}
}
}