<html> <head> <title>Available WADs</title> </head> <body> <?php $dir = dirname(__FILE__); $files = scandir($dir); $root = $_SERVER['CONTEXT_DOCUMENT_ROOT']; $webDir = dirname($_SERVER['SCRIPT_NAME']); //echo '<tt>' . htmlentities(json_encode($_SERVER)) . '</tt><br>'; //echo __FILE__ . '<br>'; //echo $dir . '<br>'; //echo $root . '<br>'; //echo $webDir . '<br>'; foreach ($files as $file) { $info = pathinfo($file); //echo '<tt>' . htmlentities(json_encode($info)) . '</tt><br>'; if (strtolower($info['extension']) == 'wad') { echo '<a href="' . $webDir . '/' . $file . '">' . $file . '</a><br>'; } } ?> </body> </html>