codefox
01-15-2003, 06:53 AM
I use the following function to get the URL of the current document. It works fine when the version of PHP is >= 4.1.0 but does not give the HTTP_HOST for versions below, so the link looks like http:///somedoc.php. Any suggestions?
function GetDocumentURL()
{
$ver = str_replace(".", "", phpversion());
if ($ver < 410) {
global $PHP_SELF;
return "http://" . $HTTP_SERVER_VARS['HTTP_HOST'] . $PHP_SELF;
}
else
return "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
}
Thanks.
function GetDocumentURL()
{
$ver = str_replace(".", "", phpversion());
if ($ver < 410) {
global $PHP_SELF;
return "http://" . $HTTP_SERVER_VARS['HTTP_HOST'] . $PHP_SELF;
}
else
return "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
}
Thanks.