From 5584e3b72c5a06bab66d7995a013e2ddf2ff1b1b Mon Sep 17 00:00:00 2001 From: billz Date: Tue, 25 Mar 2025 13:58:52 -0700 Subject: [PATCH] Initial commit --- includes/CSRF.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 includes/CSRF.php diff --git a/includes/CSRF.php b/includes/CSRF.php new file mode 100644 index 00000000..361c8fbb --- /dev/null +++ b/includes/CSRF.php @@ -0,0 +1,42 @@ +getToken(); + } + + public static function verify(): bool + { + return self::instance()->csrfValidateRequest() && self::instance()->CSRFValidate($_POST['csrf_token'] ?? ''); + } + + public static function metaTag(): string + { + return self::getInstance()->CSRFMetaTag(); + } + + public static function hiddenField(): string + { + return self::getInstance()->CSRFTokenFieldTag(); + } + + public static function handleInvalidToken(): void + { + self::instance()->handleInvalidCSRFToken(); + } +} +