diff options
Diffstat (limited to 'include/common.php')
-rw-r--r-- | include/common.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/common.php b/include/common.php index 8f57b91..ee3921b 100644 --- a/include/common.php +++ b/include/common.php @@ -13,6 +13,10 @@ return sprintf(...$args); } + function validate_csrf($csrf_token) { + return isset($csrf_token) && hash_equals($_SESSION['csrf_token'] ?? "", $csrf_token); + } + function sql_bool_to_bool($s) { return $s && ($s !== "f" && $s !== "false"); //no-op for PDO, backwards compat for legacy layer } |