summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2017-02-14 23:42:06 -0500
committerMalf Furious <m@lfurio.us>2017-02-14 23:42:06 -0500
commit093cca175e42c0d0040821b4687ebd5823e95a5f (patch)
treec6a1f21e9465c377dc5e0c2f3c5d52e71c536f0d /app
parenta4bdf800e224a64fc704b6d19b668287f030a3e8 (diff)
downloadscrott-093cca175e42c0d0040821b4687ebd5823e95a5f.tar.gz
scrott-093cca175e42c0d0040821b4687ebd5823e95a5f.zip
Add function require_https()
Diffstat (limited to '')
-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());
+}
+
?>