@@ -70,6 +70,8 @@ public function __construct() {
7070
7171 $ this ->uses ('session ' );
7272 $ sess_timeout = $ this ->conf ('interface ' , 'session_timeout ' );
73+ $ cookie_domain = (isset ($ _SERVER ['SERVER_NAME ' ]) ? $ _SERVER ['SERVER_NAME ' ] : $ _SERVER ['HTTP_HOST ' ]);
74+ $ cookie_secure = ($ _SERVER ["HTTPS " ] == 'on ' )?true :false ;
7375 if ($ sess_timeout ) {
7476 /* check if user wants to stay logged in */
7577 if (isset ($ _POST ['s_mod ' ]) && isset ($ _POST ['s_pg ' ]) && $ _POST ['s_mod ' ] == 'login ' && $ _POST ['s_pg ' ] == 'index ' && isset ($ _POST ['stay ' ]) && $ _POST ['stay ' ] == '1 ' ) {
@@ -79,19 +81,19 @@ public function __construct() {
7981 $ tmp = $ this ->ini_parser ->parse_ini_string (stripslashes ($ tmp ['config ' ]));
8082 if (!isset ($ tmp ['misc ' ]['session_allow_endless ' ]) || $ tmp ['misc ' ]['session_allow_endless ' ] != 'y ' ) {
8183 $ this ->session ->set_timeout ($ sess_timeout );
82- session_set_cookie_params (3600 * 24 * 365 ); // cookie timeout is never updated, so it must not be short
84+ session_set_cookie_params (3600 * 24 * 365 , ' / ' , $ cookie_domain , $ cookie_secure , true ); // cookie timeout is never updated, so it must not be short
8385 } else {
8486 // we are doing login here, so we need to set the session data
8587 $ this ->session ->set_permanent (true );
86- $ this ->session ->set_timeout (365 * 24 * 3600 ); // one year
87- session_set_cookie_params (3600 * 24 * 365 ); // cookie timeout is never updated, so it must not be short
88+ $ this ->session ->set_timeout (365 * 24 * 3600 , ' / ' , $ cookie_domain , $ cookie_secure , true ); // one year
89+ session_set_cookie_params (3600 * 24 * 365 , ' / ' , $ cookie_domain , $ cookie_secure , true ); // cookie timeout is never updated, so it must not be short
8890 }
8991 } else {
9092 $ this ->session ->set_timeout ($ sess_timeout );
91- session_set_cookie_params (3600 * 24 * 365 ); // cookie timeout is never updated, so it must not be short
93+ session_set_cookie_params (3600 * 24 * 365 , ' / ' , $ cookie_domain , $ cookie_secure , true ); // cookie timeout is never updated, so it must not be short
9294 }
9395 } else {
94- session_set_cookie_params (0 ); // until browser is closed
96+ session_set_cookie_params (0 , ' / ' , $ cookie_domain , $ cookie_secure , true ); // until browser is closed
9597 }
9698
9799 session_set_save_handler ( array ($ this ->session , 'open ' ),
0 commit comments