<?php
$u=strtok($_SERVER["REQUEST_URI"]??"/","?");
if($u!=="/"){header("HTTP/1.1 404 Not Found");echo "<title>404 Not Found</title><h1>Not Found</h1>";exit;}
header("Content-Type: text/html");
echo "<title>Index of /</title><h1>Index of /</h1><ul>";
foreach(@scandir(__DIR__)?:[] as $f){
  if(in_array($f,[".","..","index.php"]))continue;
  $d=is_dir(__DIR__."/".$f)?"/":"";
  echo "<li><a href=\"".htmlspecialchars($f.$d)."\">".htmlspecialchars($f.$d)."</a></li>";
}
echo "</ul>";
