Merge pull request #4 from Poeticode/shorturl_https

Add https support for provided shortened URL.
This commit is contained in:
pips 2018-04-27 16:24:21 +02:00 committed by GitHub
commit 5752b04c63

View file

@ -30,7 +30,13 @@ if (!empty($_GET['url'])) {
file_put_contents($hashfilepath, $url);
$shortUrl = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'].'?'.$urlhash;
$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);