Fixes temporary the session cookie

main
Yasen Pramatarov 2024-07-03 15:30:44 +03:00
parent 5fb2aa2fae
commit cb26576eeb
1 changed files with 12 additions and 13 deletions

View File

@ -31,19 +31,18 @@ try {
} }
// set session lifetime and cookies // set session lifetime and cookies
ini_set('session.gc_maxlifetime', $gc_maxlifetime); // FIXME: need to set this before session start (otherwise we need the separate cookie)
session_set_cookie_params([ // ini_set('session.gc_maxlifetime', $gc_maxlifetime);
'lifetime' => $setcookie_lifetime, // session_set_cookie_params([
'samesite' => 'Strict', // 'lifetime' => $setcookie_lifetime,
'httponly' => true, // 'samesite' => 'Strict',
'secure' => isset($_SERVER['HTTPS']), // 'httponly' => true,
'domain' => $config['domain'], // 'secure' => isset($_SERVER['HTTPS']),
'path' => $config['folder'] // 'domain' => $config['domain'],
]); // 'path' => $config['folder']
session_name($username); // ]);
session_start(); // session_start();
// FIXME we use separate cookie, because the above won't work
// FIXME it doesn't set a cookie with session_set_cookie_params only
setcookie('username', $username, [ setcookie('username', $username, [
'expires' => $setcookie_lifetime, 'expires' => $setcookie_lifetime,
'path' => $config['folder'], 'path' => $config['folder'],