summaryrefslogtreecommitdiff
path: root/src/application/mystic/forum/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/application/mystic/forum/utils')
-rw-r--r--src/application/mystic/forum/utils/RequestUtils.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/application/mystic/forum/utils/RequestUtils.php b/src/application/mystic/forum/utils/RequestUtils.php
new file mode 100644
index 0000000..2f40013
--- /dev/null
+++ b/src/application/mystic/forum/utils/RequestUtils.php
@@ -0,0 +1,19 @@
+<?php
+declare(strict_types=1);
+
+namespace mystic\forum\utils;
+
+use mystic\forum\Messaging;
+
+final class RequestUtils {
+ use StaticClass;
+
+ public static function ensureRequestMethod(string $method): void {
+ $rMethod = $_SERVER["REQUEST_METHOD"];
+ if (strcasecmp($rMethod, $method) !== 0) {
+ http_response_code(500);
+ Messaging::error("Invalid request method $rMethod");
+ exit;
+ }
+ }
+}