From 81fd53dc6b0fe32aa494a1cd43010a409b171243 Mon Sep 17 00:00:00 2001 From: bochard Date: Mon, 28 Apr 2025 09:53:11 +0800 Subject: [PATCH] added multiple error pages --- .htaccess | 8 ++- error_docs/401.html | 17 ++++++ error_docs/502.html | 17 ++++++ error_docs/503.html | 17 ++++++ error_docs/504.html | 17 ++++++ files/bg_music/another_folder/index.php | 42 --------------- files/bg_music/index.php | 42 --------------- files/index.php | 52 +++++++++---------- files/{bg_music => musics}/childhood2.mp3 | Bin files/musics/index.php | 5 ++ files/{bg_music => musics}/rejectedworld.mp3 | Bin files/musics/sfx/index.php | 5 ++ files/wallpapers/index.php | 45 ++-------------- 13 files changed, 114 insertions(+), 153 deletions(-) create mode 100644 error_docs/401.html create mode 100644 error_docs/502.html create mode 100644 error_docs/503.html create mode 100644 error_docs/504.html delete mode 100644 files/bg_music/another_folder/index.php delete mode 100644 files/bg_music/index.php rename files/{bg_music => musics}/childhood2.mp3 (100%) create mode 100644 files/musics/index.php rename files/{bg_music => musics}/rejectedworld.mp3 (100%) create mode 100644 files/musics/sfx/index.php diff --git a/.htaccess b/.htaccess index a9e3f3d..a3f4092 100644 --- a/.htaccess +++ b/.htaccess @@ -5,6 +5,10 @@ RewriteCond %{HTTP_HOST} ^www\.tenkyuu\.dev [NC] RewriteRule ^(.*)$ http://tenkyuu.dev/$1 [R=301,L] #error pages -ErrorDocument 404 /error_docs/404.html +ErrorDocument 401 /error_docs/401.html ErrorDocument 403 /error_docs/403.html -ErrorDocument 500 /error_docs/500.html \ No newline at end of file +ErrorDocument 404 /error_docs/404.html +ErrorDocument 500 /error_docs/500.html +ErrorDocument 502 /error_docs/502.html +ErrorDocument 503 /error_docs/503.html +ErrorDocument 504 /error_docs/504.html \ No newline at end of file diff --git a/error_docs/401.html b/error_docs/401.html new file mode 100644 index 0000000..204546b --- /dev/null +++ b/error_docs/401.html @@ -0,0 +1,17 @@ + + + + + + + + page doesn't exist!! + + +

This page requires authenticaion!

+

Are you just trying to access this page? Smells fishy, huh?!

+ + back to home + + + \ No newline at end of file diff --git a/error_docs/502.html b/error_docs/502.html new file mode 100644 index 0000000..e8e701d --- /dev/null +++ b/error_docs/502.html @@ -0,0 +1,17 @@ + + + + + + + + page doesn't exist!! + + +

The Gateway is BADASS.

+

There's a gate problem, it won't budge. It might been stuck.

+ + back to home + + + \ No newline at end of file diff --git a/error_docs/503.html b/error_docs/503.html new file mode 100644 index 0000000..38b5d52 --- /dev/null +++ b/error_docs/503.html @@ -0,0 +1,17 @@ + + + + + + + + page doesn't exist!! + + +

Service is unavailable for some reason...

+

Wait, the waiter is still serving other people. Give some time to him, he's doing his best.

+ + back to home + + + \ No newline at end of file diff --git a/error_docs/504.html b/error_docs/504.html new file mode 100644 index 0000000..2a1129b --- /dev/null +++ b/error_docs/504.html @@ -0,0 +1,17 @@ + + + + + + + + page doesn't exist!! + + +

You're too slow.

+

The gate has a timer, you didn't reached it.

+ + back to home + + + \ No newline at end of file diff --git a/files/bg_music/another_folder/index.php b/files/bg_music/another_folder/index.php deleted file mode 100644 index 1067e45..0000000 --- a/files/bg_music/another_folder/index.php +++ /dev/null @@ -1,42 +0,0 @@ -"; - echo "Index of $fullPath"; - echo ""; - echo "

Index of $fullPath


";
-    echo '../' . PHP_EOL;
-
-    $items = [];
-    while (false !== ($entry = readdir($handle))) {
-        if ($entry != "." && $entry != ".." && $entry != "index.php") {
-            $items[] = $entry;
-        }
-    }
-    closedir($handle);
-
-    sort($items);
-
-    foreach ($items as $entry) {
-        $filePath = "./" . $entry;
-        $lastModified = date("d-M-Y H:i", filemtime($filePath));
-        $size = is_dir($filePath) ? "-" : filesize($filePath);
-        $link = htmlspecialchars($entry);
-
-        if (is_dir($filePath)) {
-            $link .= '/';
-        }
-
-        echo "$link" . str_repeat(" ", 50 - strlen($link)) . "$lastModified" . str_repeat(" ", 10 - strlen($size)) . "$size" . PHP_EOL;
-    }
-
-    echo "

"; - echo ""; - echo ""; -} else { - echo "Unable to open directory."; -} -?> \ No newline at end of file diff --git a/files/bg_music/index.php b/files/bg_music/index.php deleted file mode 100644 index 1067e45..0000000 --- a/files/bg_music/index.php +++ /dev/null @@ -1,42 +0,0 @@ -"; - echo "Index of $fullPath"; - echo ""; - echo "

Index of $fullPath


";
-    echo '../' . PHP_EOL;
-
-    $items = [];
-    while (false !== ($entry = readdir($handle))) {
-        if ($entry != "." && $entry != ".." && $entry != "index.php") {
-            $items[] = $entry;
-        }
-    }
-    closedir($handle);
-
-    sort($items);
-
-    foreach ($items as $entry) {
-        $filePath = "./" . $entry;
-        $lastModified = date("d-M-Y H:i", filemtime($filePath));
-        $size = is_dir($filePath) ? "-" : filesize($filePath);
-        $link = htmlspecialchars($entry);
-
-        if (is_dir($filePath)) {
-            $link .= '/';
-        }
-
-        echo "$link" . str_repeat(" ", 50 - strlen($link)) . "$lastModified" . str_repeat(" ", 10 - strlen($size)) . "$size" . PHP_EOL;
-    }
-
-    echo "

"; - echo ""; - echo ""; -} else { - echo "Unable to open directory."; -} -?> \ No newline at end of file diff --git a/files/index.php b/files/index.php index 1067e45..3921ebc 100755 --- a/files/index.php +++ b/files/index.php @@ -4,39 +4,39 @@ $urlPath = rtrim($urlPath, "/"); $fullPath = $urlPath === "" ? "/" : $urlPath; if ($handle = opendir(".")) { - echo ""; - echo "Index of $fullPath"; - echo ""; - echo "

Index of $fullPath


";
-    echo '../' . PHP_EOL;
+  echo "";
+  echo "Index of $fullPath";
+  echo "";
+  echo "

Index of $fullPath


";
+  echo '../' . PHP_EOL;
 
-    $items = [];
-    while (false !== ($entry = readdir($handle))) {
-        if ($entry != "." && $entry != ".." && $entry != "index.php") {
-            $items[] = $entry;
-        }
+  $items = [];
+  while (false !== ($entry = readdir($handle))) {
+    if ($entry != "." && $entry != ".." && $entry != "index.php") {
+      $items[] = $entry;
     }
-    closedir($handle);
+  }
+  closedir($handle);
 
-    sort($items);
+  sort($items);
 
-    foreach ($items as $entry) {
-        $filePath = "./" . $entry;
-        $lastModified = date("d-M-Y H:i", filemtime($filePath));
-        $size = is_dir($filePath) ? "-" : filesize($filePath);
-        $link = htmlspecialchars($entry);
+  foreach ($items as $entry) {
+    $filePath = "./" . $entry;
+    $lastModified = date("d-M-Y H:i", filemtime($filePath));
+    $size = is_dir($filePath) ? "-" : filesize($filePath);
+    $link = htmlspecialchars($entry);
 
-        if (is_dir($filePath)) {
-            $link .= '/';
-        }
-
-        echo "$link" . str_repeat(" ", 50 - strlen($link)) . "$lastModified" . str_repeat(" ", 10 - strlen($size)) . "$size" . PHP_EOL;
+    if (is_dir($filePath)) {
+      $link .= '/';
     }
 
-    echo "

"; - echo ""; - echo ""; + echo "$link" . str_repeat(" ", 50 - strlen($link)) . "$lastModified" . str_repeat(" ", 10 - strlen($size)) . "$size" . PHP_EOL; + } + + echo "

"; + echo ""; + echo ""; } else { - echo "Unable to open directory."; + echo "Unable to open directory."; } ?> \ No newline at end of file diff --git a/files/bg_music/childhood2.mp3 b/files/musics/childhood2.mp3 similarity index 100% rename from files/bg_music/childhood2.mp3 rename to files/musics/childhood2.mp3 diff --git a/files/musics/index.php b/files/musics/index.php new file mode 100644 index 0000000..59ec2e4 --- /dev/null +++ b/files/musics/index.php @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/files/bg_music/rejectedworld.mp3 b/files/musics/rejectedworld.mp3 similarity index 100% rename from files/bg_music/rejectedworld.mp3 rename to files/musics/rejectedworld.mp3 diff --git a/files/musics/sfx/index.php b/files/musics/sfx/index.php new file mode 100644 index 0000000..59ec2e4 --- /dev/null +++ b/files/musics/sfx/index.php @@ -0,0 +1,5 @@ + + \ No newline at end of file diff --git a/files/wallpapers/index.php b/files/wallpapers/index.php index 1067e45..59ec2e4 100644 --- a/files/wallpapers/index.php +++ b/files/wallpapers/index.php @@ -1,42 +1,5 @@ "; - echo "Index of $fullPath"; - echo ""; - echo "

Index of $fullPath


";
-    echo '../' . PHP_EOL;
-
-    $items = [];
-    while (false !== ($entry = readdir($handle))) {
-        if ($entry != "." && $entry != ".." && $entry != "index.php") {
-            $items[] = $entry;
-        }
-    }
-    closedir($handle);
-
-    sort($items);
-
-    foreach ($items as $entry) {
-        $filePath = "./" . $entry;
-        $lastModified = date("d-M-Y H:i", filemtime($filePath));
-        $size = is_dir($filePath) ? "-" : filesize($filePath);
-        $link = htmlspecialchars($entry);
-
-        if (is_dir($filePath)) {
-            $link .= '/';
-        }
-
-        echo "$link" . str_repeat(" ", 50 - strlen($link)) . "$lastModified" . str_repeat(" ", 10 - strlen($size)) . "$size" . PHP_EOL;
-    }
-
-    echo "

"; - echo ""; - echo ""; -} else { - echo "Unable to open directory."; -} -?> \ No newline at end of file + $path = $_SERVER['DOCUMENT_ROOT']; + $path .= '/files'; +?> + \ No newline at end of file -- 2.39.5