<?php
// Get current directory
$dir = realpath(dirname(__FILE__));

// Scan directory
$files = scandir($dir);
?>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Directory Listing</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background: #f5f5f5;
            padding: 20px;
        }
        h2 {
            margin-bottom: 15px;
        }
        ul {
            list-style: none;
            padding: 0;
        }
        li {
            background: #fff;
            margin-bottom: 8px;
            padding: 10px 15px;
            border-radius: 6px;
        }
        a {
            text-decoration: none;
            color: #333;
        }
        a:hover {
            color: #0073e6;
        }
        .folder {
            font-weight: bold;
        }
    </style>
</head>
<body>

<h2>📁 Directory Listing</h2>

<ul>
<?php
foreach ($files as $file) {
    if ($file !== "." && $file !== "..") {
        if (is_dir($file)) {
            echo "<li class='folder'>📂 <a href='$file/'>$file</a></li>";
        } else {
            echo "<li>📄 <a href='$file'>$file</a></li>";
        }
    }
}
?>
</ul>

</body>
</html>
