Skip to content

Commit cc8e2e2

Browse files
committed
Merge pull request fossar#355 from zajad/patch-1
Update Authentication.php
2 parents b15a1ce + 9ac92c1 commit cc8e2e2

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

helpers/Authentication.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,16 @@ class Authentication {
3030
* start session and check login
3131
*/
3232
public function __construct() {
33+
34+
// check for SSL proxy and special cookie options
35+
if(isset($_SERVER['HTTP_X_FORWARDED_SERVER'])) {
36+
// set cookie details (http://php.net/manual/en/function.setcookie.php)
37+
// expire, path, domain, secure, httponly
38+
session_set_cookie_params((3600*24*30), '/'.$_SERVER['SERVER_NAME'].preg_replace('/\/[^\/]+$/','',$_SERVER['PHP_SELF']).'/', $_SERVER['HTTP_X_FORWARDED_SERVER'], "true", "true");
39+
} else {
3340
// session cookie will be valid for one month
3441
session_set_cookie_params((3600*24*30), "/");
42+
}
3543

3644
session_name();
3745
if(session_id()=="")
@@ -117,4 +125,4 @@ public function logout() {
117125
$_SESSION['loggedin'] = false;
118126
session_destroy();
119127
}
120-
}
128+
}

0 commit comments

Comments
 (0)