I have a snipet of code i'm using for a file maintanance program. I have no
idea why but when the main loop repeats, the is_dir function doesn't return
true even though it prints out a directory in the server.

chdir("/certain/place/for/files/");
$handle=opendir(".");
$file=readdir($handle); //to get rid of "." and ".."
$file=readdir($handle);
while($file=readdir($handle))
{
if (is_dir($file)){
chdir("/certain/place/for/files/".$file."/");
$handle2=opendir(".");
$file2=readdir($handle2);
$file2=readdir($handle2);
while($file2=readdir($handle2))
{
?>
<tr bgcolor="<?php
if ($j==0)
{
echo "ffffff";
$j=1;
}
else if ($j==1)
{
echo "ffffcf";
$j=0;
}
?>">
<td><a href="website<?php echo $file;?>/<?php echo
$file2;?>">[view]</a></td>
<td><?php echo $file2;?></td>
<td><a href="deleteimage.php3?file=<?php echo $file2;?>&root=<?php echo
$file;?>">[delete]</a></td>
</tr>
<?
}
}
else{
?>
<tr bgcolor="<?php
if ($j==0)
{
echo "ffffff";
$j=1;
}
else if ($j==1)
{
echo "ffffcf";
$j=0;
}
?>">
<td><a href="website<?php echo $file;?>">[view]</a></td>
<td><?php echo $file;?></td>
<td><a href="deleteimage.php3?file=<?php echo
$file;?>&root=/">[delete]</a></td>
</tr>
<?
}

the script will print out the contents of the first directory but then the
others are never opened, just printed out.

Thanks
Patrick

}

Reply via email to