diff options
Diffstat (limited to 'php/user.php')
| -rw-r--r-- | php/user.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/php/user.php b/php/user.php index 8a424e5..9521dc5 100644 --- a/php/user.php +++ b/php/user.php @@ -19,6 +19,7 @@ require_once ROOT . '/php/session.php'; require_once ROOT . '/php/database.php'; +require_once ROOT . '/php/render.php'; const USER_STATUSES = ['none', 'member', 'mod', 'admin']; @@ -46,4 +47,15 @@ function is_admin(): bool { return $user !== null && $user['status'] === 'admin'; } +function require_admin(): void { + if (is_admin()) { + return; + } + + http_response_code(403); + + render_content(ROOT . '/html/forbidden.html'); + exit; +} + ?> |
