let browser determine http/https

This commit is contained in:
Silas 2018-04-26 16:28:26 -04:00
parent 34705ff259
commit 426c938bd0

View file

@ -30,11 +30,11 @@ 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;
$qrcode = (new QrCode())->setText($shortUrl);
$content = '<a href="'.$shortUrl.'">'.$shortUrl.'</a><br>'
$content = '<a href="//'.$shortUrl.'">'.$shortUrl.'</a><br>'
.'<img src="data:'.$qrcode->getContentType().';base64,'.base64_encode($qrcode->get()).'">';
} elseif (!empty($_GET)) {
$urlhash = key($_GET);