1
0
mirror of https://github.com/Rouji/single_php_filehost.git synced 2025-04-10 19:08:45 +00:00

Explicitly check for $_SERVER['HTTP_HOST']

This commit is contained in:
mul91n 2021-08-22 21:25:32 +10:00
parent 76dff59ab7
commit 9d81fd1f20

View File

@ -19,13 +19,16 @@ $ADMIN_EMAIL="admin@example.com"; //address for inquiries
function site_url() function site_url()
{ {
$url = 'http'; if (isset($_SERVER['HTTP_HOST']))
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
{ {
$url .= 's'; $url = 'http';
} if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
$url .= '://' . $_SERVER['HTTP_HOST'] . '/'; {
return $url; $url .= 's';
}
$url .= '://' . $_SERVER['HTTP_HOST'] . '/';
return $url;
}
} }
// generate a random string of characters with given length // generate a random string of characters with given length