diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/class/globals.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/class/globals.php b/app/class/globals.php index c936488..8bfa029 100644 --- a/app/class/globals.php +++ b/app/class/globals.php @@ -53,4 +53,14 @@ function location(string $path) : void redirect(ar() . $path); } +/* + * Assert that the current connection to the server is over HTTPS. Redirect + * if not. + */ +function require_https() : void +{ + if (!isset($_SERVER['HTTPS'])) + redirect("https://" . $_SERVER['SERVER_NAME'] . ap()); +} + ?> |