From c9d8decf3865940062898271145d548331f8ed66 Mon Sep 17 00:00:00 2001 From: Silas Date: Thu, 26 Apr 2018 16:53:01 -0400 Subject: [PATCH] determine https/http via php server variable to ensure QR code works properly --- index.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index 0fb05be..7d208e4 100644 --- a/index.php +++ b/index.php @@ -32,9 +32,15 @@ if (!empty($_GET['url'])) { $shortUrl = $_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'?'.$urlhash; + if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') { + $shortUrl = 'https://'.$shortUrl; + } else { + $shortUrl = 'http://'.$shortUrl; + } + $qrcode = (new QrCode())->setText($shortUrl); - $content = ''.$shortUrl.'
' + $content = ''.$shortUrl.'
' .''; } elseif (!empty($_GET)) { $urlhash = key($_GET);