<?php
$callbacks[$delimiter] = function($matches) use ($delimiter) {
    return $delimiter . strtolower($matches[1]);
};
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<?php
include("password_protect.php");
$files = array();
$dir = opendir('.'); // open the cwd..also do an err check.
while(false != ($file = readdir($dir))) {
        if(($file != ".") and ($file != "..") and ($file != "index.php")) {
                $files[] = $file; // put in array.
        }   
}

natsort($files); // sort.

// print.
?>
<h1>Index of /<?php echo basename(__DIR__); ?></h1>
<ul>
<li><a href="../">Parent Directory</a></li>
<?php
foreach($files as $file) {
	if(is_dir($file)) {
        echo("<li><a href='$file'>$file/</a></li>\n");
	}else{
		echo("<li><a href='$file'>$file</a></li>\n");
	}
}
?>
</ul>
</body>
</html>