From cb26576eeb4d7ce2f83e61a8d403bdca158b8890 Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Wed, 3 Jul 2024 15:30:44 +0300 Subject: [PATCH] Fixes temporary the session cookie --- public_html/pages/login.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/public_html/pages/login.php b/public_html/pages/login.php index ff62180..3f651cb 100644 --- a/public_html/pages/login.php +++ b/public_html/pages/login.php @@ -31,19 +31,18 @@ try { } // set session lifetime and cookies - ini_set('session.gc_maxlifetime', $gc_maxlifetime); - session_set_cookie_params([ - 'lifetime' => $setcookie_lifetime, - 'samesite' => 'Strict', - 'httponly' => true, - 'secure' => isset($_SERVER['HTTPS']), - 'domain' => $config['domain'], - 'path' => $config['folder'] - ]); - session_name($username); - session_start(); - - // FIXME it doesn't set a cookie with session_set_cookie_params only +// FIXME: need to set this before session start (otherwise we need the separate cookie) +// ini_set('session.gc_maxlifetime', $gc_maxlifetime); +// session_set_cookie_params([ +// 'lifetime' => $setcookie_lifetime, +// 'samesite' => 'Strict', +// 'httponly' => true, +// 'secure' => isset($_SERVER['HTTPS']), +// 'domain' => $config['domain'], +// 'path' => $config['folder'] +// ]); +// session_start(); +// FIXME we use separate cookie, because the above won't work setcookie('username', $username, [ 'expires' => $setcookie_lifetime, 'path' => $config['folder'],