summaryrefslogtreecommitdiffstats
path: root/app/class/globals.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/class/globals.php')
-rw-r--r--app/class/globals.php10
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());
+}
+
?>