<?php
$files = array_diff(scandir('.'), ['.', '..', 'index.php']);
sort($files);
?>
<!DOCTYPE html>
<html lang="fr">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Index — /pub</title>
  <style>
    body { font-family: monospace; max-width: 700px; margin: 40px auto; padding: 0 20px 80px; }
    h1 { font-size: 1.2em; border-bottom: 1px solid #ccc; padding-bottom: 8px; }
    ul { list-style: none; padding: 0; }
    li { padding: 6px 0; border-bottom: 1px solid #eee; }
    a { text-decoration: none; color: #0066cc; }
    a:hover { text-decoration: underline; }
    footer { position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 20px; background: #fff; border-top: 1px solid #ddd; text-align: center; }
    footer a { display: inline-block; padding: 8px 24px; background: #333; color: #fff; border-radius: 4px; font-family: sans-serif; font-size: 0.95em; }
    footer a:hover { background: #555; color: #fff; }
  </style>
</head>
<body>
  <h1>Contenu du dossier</h1>
  <ul>
    <?php foreach ($files as $file): ?>
    <li><a href="<?= htmlspecialchars(rawurlencode($file)) ?>"><?= htmlspecialchars($file) ?></a></li>
    <?php endforeach; ?>
  </ul>
  <footer>
    <a href="upload.php">Upload</a>
  </footer>
</body>
</html>
