I have a directory called Documents broken down into sub directories with pdf files in those sub directories. I found this code that will list the sub directories and it works OK. When I click on one of the sub directories I get an error message saying that I don't have permission to see that page.
"You are not authorized to view this page
You might not have permission to view this directory or page using the credentials you supplied. "
I am using IIS and XP Pro with PHP 4.3.4
I went to IIS and allowed anonymous acces to the directories.
What else do I have to do to see the contents of the directories?
Here is the program I am running:
<?
function scandir($dir, $no_dots=FALSE) {
$files = array();
$dh = @opendir($dir);
if ($dh!=FALSE) {
while (false !== ($filename = readdir($dh))) {
$files[] = $filename;
}
if ($no_dots) {
while(($ix = array_search('.',$files)) > -1)
unset($files[$ix]);
while(($ix = array_search('..',$files)) > -1)
unset($files[$ix]);
}
sort($files);
}
return $files;
}
?>
</head>
<body>
<?
$list = scandir("Documents");
$i = 0;
$num = count($list);
while($i < $num){
print "<a href=\"Documents/$list[$i]\">$list[$i]</a><br />";
$i++;
}
?>