summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2015-11-22 21:16:44 +0000
committerLuke Bratch <luke@bratch.co.uk>2015-11-22 21:16:44 +0000
commit0ae7bd19f00a8737b8f212e7b6b47f0f5adf8a16 (patch)
treed26f3965093b4f5d10c03a006cbbb14c1cbc3d5b /index.php
parentee66f2046089f2dce3d84185a3807f2711319d66 (diff)
Make redirects and hyperlinks respect whether or not HTTPS is being used
Diffstat (limited to 'index.php')
-rw-r--r--index.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/index.php b/index.php
index d518bbc..e00f42a 100644
--- a/index.php
+++ b/index.php
@@ -3,6 +3,13 @@ include('config.php');
$signout = '<a href="' . basename($_SERVER['PHP_SELF']) . '?signout">Sign out</a>';
+// Respect HTTPS or not
+if (isset($_SERVER['HTTPS'])) {
+ $url = preg_replace("/^http:\/\//", "https://", $url);
+} else {
+ $url = preg_replace("/^https:\/\//", "http://", $url);
+}
+
if (isset($_GET) && count($_GET) > 0) {
$getstring = "?" . http_build_query($_GET);
} else {