1
0
mirror of https://github.com/Rouji/single_php_filehost.git synced 2025-04-26 03:27:17 +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,6 +19,8 @@ $ADMIN_EMAIL="admin@example.com"; //address for inquiries
function site_url() function site_url()
{ {
if (isset($_SERVER['HTTP_HOST']))
{
$url = 'http'; $url = 'http';
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
{ {
@ -26,6 +28,7 @@ function site_url()
} }
$url .= '://' . $_SERVER['HTTP_HOST'] . '/'; $url .= '://' . $_SERVER['HTTP_HOST'] . '/';
return $url; return $url;
}
} }
// generate a random string of characters with given length // generate a random string of characters with given length