Get current URL in php

This commit is contained in:
Tobias Reich 2014-02-09 00:34:49 +01:00
parent 2a745b5304
commit e0b8375e28

View File

@ -95,4 +95,17 @@ function update() {
} }
function pageURL() {
$pageURL = 'http';
if (isset($_SERVER["HTTPS"])&&$_SERVER["HTTPS"]==="on") $pageURL .= "s";
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"]!="80") $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER['SCRIPT_NAME'];
else $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER['SCRIPT_NAME'];
return $pageURL;
}
?> ?>