Prevent "undefined index 'HTTPS'" Notice

In servers where notice error_level is enabled, php prints this notice
which mixed in to url.
This commit is contained in:
Fatih Orhan 2013-04-04 11:10:31 +03:00
parent c44908ddd0
commit aa8e0a27e2
1 changed files with 5 additions and 1 deletions

View File

@ -53,7 +53,11 @@ switch ($action) {
}
function url(){
$protocol = ($_SERVER['HTTPS'] && $_SERVER['HTTPS'] != "off") ? "https" : "http";
$protocol = "http";
if(isset($_SERVER['HTTPS']))
if($_SERVER['HTTPS'] != "off")
$protocol = "https";
return $protocol . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
}
?>