HTTPS detection on IIS

This commit is contained in:
bfabiszewski 2014-03-05 20:12:36 +01:00
parent bc0aac55c5
commit 9e42c79bbc
2 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ if ($require_authentication) {
$auth = (isset($_SESSION['auth']) ? $_SESSION['auth'] : ""); $auth = (isset($_SESSION['auth']) ? $_SESSION['auth'] : "");
$user = (isset($_REQUEST['user']) ? $_REQUEST['user'] : ""); $user = (isset($_REQUEST['user']) ? $_REQUEST['user'] : "");
$pass = (isset($_REQUEST['pass']) ? md5($salt.$_REQUEST['pass']) : ""); $pass = (isset($_REQUEST['pass']) ? md5($salt.$_REQUEST['pass']) : "");
@$ssl = ($_SERVER['HTTPS'] == "" ? "http" : "https"); $ssl = ((!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "" || $_SERVER['HTTPS'] == "off") ? "http" : "https");
$auth_error = (isset($_REQUEST['auth_error']) ? $_REQUEST['auth_error'] : 0); $auth_error = (isset($_REQUEST['auth_error']) ? $_REQUEST['auth_error'] : 0);
// not authenticated and username not submited // not authenticated and username not submited

View File

@ -24,7 +24,7 @@ if (isset($_COOKIE[session_name('trackme')])) {
setcookie(session_name('trackme'),'',time()-42000,'/'); setcookie(session_name('trackme'),'',time()-42000,'/');
} }
session_destroy(); session_destroy();
@$ssl = ($_SERVER['HTTPS'] == "" ? "http" : "https"); $ssl = ((!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "" || $_SERVER['HTTPS'] == "off") ? "http" : "https");
$url = str_replace("//", "/", $_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php"); $url = str_replace("//", "/", $_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php");
header("Location: $ssl://$url"); header("Location: $ssl://$url");
?> ?>