Merge pull request #4 from Poeticode/shorturl_https
Add https support for provided shortened URL.
This commit is contained in:
commit
5752b04c63
1 changed files with 7 additions and 1 deletions
|
|
@ -30,7 +30,13 @@ if (!empty($_GET['url'])) {
|
||||||
|
|
||||||
file_put_contents($hashfilepath, $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);
|
$qrcode = (new QrCode())->setText($shortUrl);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue