1
0
mirror of https://github.com/Rouji/single_php_filehost.git synced 2025-04-25 19:17: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

@ -18,6 +18,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')
@ -27,6 +29,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
function rnd_str($len) function rnd_str($len)