diff options
author | haturatu <taro@eyes4you.org> | 2024-09-02 21:58:53 +0900 |
---|---|---|
committer | haturatu <taro@eyes4you.org> | 2024-09-02 21:58:53 +0900 |
commit | 530bba11d54e755325c3457c365733375082e8a3 (patch) | |
tree | ea5350f9a8258e9797ad47c8eab2cd486f7afbf5 |
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | index.php | 54 | ||||
-rw-r--r-- | style.css | 73 |
3 files changed, 129 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..8acd30b --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# roxanne + [https://files.soulminingrig.com/](https://files.soulminingrig.com/) diff --git a/index.php b/index.php new file mode 100644 index 0000000..c639b21 --- /dev/null +++ b/index.php @@ -0,0 +1,54 @@ +<?php +$directory = './'; + +if (!is_dir($directory)) { + die("指定されたディレクトリは存在しません。"); +} + +$files = scandir($directory); + +// 除外ファイルとエントリー +$files = array_diff($files, array('.', '..', 'index.php', 'style.css')); + +// HTML +echo "<!DOCTYPE html>"; +echo "<html lang='ja'>"; +echo "<head>"; +echo "<meta charset='UTF-8'>"; +echo "<meta name='viewport' content='width=device-width, initial-scale=1.0'>"; +echo "<title>Files</title>"; +echo "<link rel='stylesheet' href='style.css'>"; +echo "</head>"; +echo "<body>"; + +echo "<div class='container'>"; +echo "<h1>Index of: " . htmlspecialchars($directory) . "</h1>"; +echo "<ul>"; + +// リスト表示 +foreach ($files as $file) { + $fullPath = $directory . '/' . $file; + if (is_dir($fullPath)) { + echo "<li class='directory'><a href='" . htmlspecialchars($file) . "/'>" . htmlspecialchars($file) . "/</a></li>"; + } else { + $size = filesize($fullPath); + $sizeFormatted = formatSize($size); + echo "<li class='file'><a href='" . htmlspecialchars($file) . "'>" . htmlspecialchars($file) . "</a> <span class='size'>(" . $sizeFormatted . ")</span></li>"; + } +} + +echo "</ul>"; +echo "</div>"; +echo "</body>"; +echo "</html>"; + +function formatSize($bytes) { + $units = array('B', 'KB', 'MB', 'GB', 'TB'); + $bytes = max($bytes, 0); + $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); + $pow = min($pow, count($units) - 1); + $bytes /= (1 << (10 * $pow)); + return round($bytes, 2) . ' ' . $units[$pow]; +} +?> + diff --git a/style.css b/style.css new file mode 100644 index 0000000..63c7fac --- /dev/null +++ b/style.css @@ -0,0 +1,73 @@ +body { + font-family: Arial, sans-serif; + margin: 0; + padding: 0; + background-color: #f0f0f0; +} + +.container { + max-width: 800px; + margin: 0 auto; + padding: 20px; + background-color: white; + box-shadow: 0 0 10px rgba(0,0,0,0.1); +} + +h1 { + color: #333; + border-bottom: 2px solid #333; + padding-bottom: 10px; +} + +ul { + list-style-type: none; + padding: 0; +} + +li { + margin-bottom: 10px; + padding: 10px; + background-color: #f9f9f9; + border-radius: 5px; +} + +li:hover { + background-color: #e9e9e9; +} + +a { + color: #9AA12D; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +.directory::before { + content: "📁 "; +} + +.file::before { + content: "📄 "; +} + +.size { + color: #666; + font-size: 0.9em; +} + +@media (max-width: 600px) { + .container { + padding: 10px; + } + + h1 { + font-size: 1.5em; + } + + li { + padding: 5px; + } +} + |