diff --git a/functions/functions.php b/functions/functions.php index 602a54e..3e33238 100644 --- a/functions/functions.php +++ b/functions/functions.php @@ -333,39 +333,3 @@ function identical_values(array $arrayA, array $arrayB):bool { } -/** - * Function for retrieving the anti-csrf token or generating it if need be. - * - * @return string - */ -function getAntiCsrfToken():string { - - if (empty($_SESSION['csrf-token'])) { - $_SESSION['csrf-token'] = bin2hex(random_bytes(32)); - } - - return $_SESSION['csrf-token']; - -} - -/** - * Function for validating anti-csrf tokens. Each anti-csrf token is removed - * after use. - * - * @return boolean - */ -function validateAntiCsrfToken():bool { - - $validity = false; - if (!empty($_POST['csrf-token']) - && !empty($_SESSION['csrf-token']) - && hash_equals($_SESSION['csrf-token'], $_POST['csrf-token']) === true - ) { - $validity = true; - } - $_SESSION['csrf-token'] = null; unset($_SESSION['csrf-token']); - - return $validity; - -} - diff --git a/public/index.php b/public/index.php index dc6cbba..b6c7c72 100644 --- a/public/index.php +++ b/public/index.php @@ -38,7 +38,7 @@ echo '