Only create cookie when needed
This commit is contained in:
parent
131f92b56c
commit
78932c0a7f
1 changed files with 22 additions and 13 deletions
|
@ -14,9 +14,17 @@ require "inc/reg.inc.php";
|
|||
require "inc/pages.inc.php";
|
||||
|
||||
// Session initialisation (with cookies)
|
||||
if (
|
||||
isset($_COOKIE['niver']) // Resume session
|
||||
OR
|
||||
(SERVICE === "auth"
|
||||
AND PAGE === "login"
|
||||
AND isset($_POST['username']))
|
||||
) {
|
||||
session_start([
|
||||
'name' => 'niver',
|
||||
'sid_length' => 64,
|
||||
'sid_bits_per_character' => 6,
|
||||
'cookie_secure' => true,
|
||||
'cookie_httponly' => true,
|
||||
'cookie_samesite' => 'Strict',
|
||||
|
@ -27,6 +35,7 @@ session_start([
|
|||
'use_cookies' => true,
|
||||
'use_only_cookies' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
// Redirect to the login page if not logged in
|
||||
if (SERVICE != "auth" AND !isset($_SESSION['username'])) {
|
||||
|
|
Loading…
Reference in a new issue