Hey I've been messing with this script for the last few days now with no luck figuring out why its not working.
I'm trying to list all files in a directory for download by letter name: ie viewfiles.php?letter=a and all files in downloads/a/ will appear on the website. Here is the script:
<?php
$handle=opendir('UMaps/$HTTP_GET_VARS[letter]/');
while($file=readdir($handle)) {
if ($file == '.' OR $file == '..' OR $file == 'index.php') {
echo "";
} else {
$i = 0;
$ls[$i]=$file;
$i++;
}
}
closedir($handle);
sort($ls);
?>
and where I want the files listed:
<?php
$n=0;
while ($n<$i) {
echo "<a class='php' href='http://www.mapheaven.net/UMaps/$HTTP_GET_VARS[letter]/$ls[$n]'>$ls[$n]</a><br>";
$n++;
}
I call the page with maps.php?letter=something and everytime I do this it gives me the error message directory not found. Is it just not possible to pass a variable into this function???? If anyone has a suggestion, please feel free.