Factor out short url in dedicated var

This commit is contained in:
pips 2017-02-07 13:07:39 +01:00
parent c9906be861
commit 059ade3de9

View file

@ -25,7 +25,10 @@ if (!empty($_GET['url'])) {
mkdir($hashfolderpath, 0700, true);
file_put_contents($hashfilepath, $url);
$content = '<a href="./?'.$urlhash.'">http://'.$_SERVER['HTTP_HOST'].'/?'.$urlhash.'</a>';
$shortUrl = 'http://'.$_SERVER['HTTP_HOST'].'/'.$_SERVER['SCRIPT_NAME'].'?'.$urlhash;
$content = '<a href="'.$shortUrl.'">'.$shortUrl.'</a>';
} elseif (!empty($_GET)) {
$urlhash = key($_GET);