From 275e155e485aa6f34c147dd1257ab28f4c64c8ea Mon Sep 17 00:00:00 2001 From: Kody Date: Mon, 26 May 2025 22:51:21 +0200 Subject: [PATCH] Minor changes but it makes more sense --- index.php | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/index.php b/index.php index 452ae66..bb9fe22 100644 --- a/index.php +++ b/index.php @@ -1,7 +1,7 @@ format('c'))); - exit; + // Redirect, with the "+" replaced by "_" + header('Location: /' . str_replace('+', '_', $dateObj->format('c'))); + exit; } elseif ($_SERVER['REQUEST_URI'] !== '/') { + // -- Show date infos // Remove leading "/" $req = substr($_SERVER['REQUEST_URI'], 1); - // -- Show date infos - // First check if date is following the format + // Check if date is following the format $re = '/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}[\_|-]\d{2}:\d{2}$/'; if (!preg_match($re, $req)) { http_response_code(404); @@ -92,7 +94,7 @@ try { } } catch (Exception $e) { http_response_code(400); - $error = 'Invalid date format or date out of range.'; + $error = 'Date is not valid, or wrong format.'; } ?> @@ -192,7 +194,7 @@ try {
- +