Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions login/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
// - Ensure Cookies are not available to Javascript
// - Cookies are sent on https only
$domain = ($_SERVER['HTTP_HOST'] !== 'localhost') ? $_SERVER['SERVER_NAME'] : false;
session_set_cookie_params (0, "/", $domain, true, true);
$is_secure = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] === "on");
session_set_cookie_params (0, "/", $domain, $is_secure, true);

// Create a session
session_start();
Expand All @@ -86,7 +87,7 @@
// Checking which URL we should redirect the user to
if (isset($_POST["from"])) {
$from = urldecode($_POST["from"]);
$redirectTo = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] === "on")? "https://" : "http://").$_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$from;
$redirectTo = ($is_secure ? "https://" : "http://").$_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$from;
}
else {
$redirectTo = AUTH_SUCCEED_REDIRECT_URL;
Expand All @@ -102,4 +103,4 @@
require_once("loginForm.php");
}
}
?>
?>
7 changes: 6 additions & 1 deletion nginx/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@
}

if ($canLog) {
$debugHandle = fopen ($debugFileName ,"a");
$mode = "a";
if (file_exists($debugFileName) AND filesize($debugFileName) > 104857600)
{
$mode = "w";
}
$debugHandle = fopen ($debugFileName, $mode);

foreach ($_SERVER as $key => $value) {
if (is_array($value)) {
Expand Down