Remember user after logging in

This commit is contained in:
Jay Trees 2022-03-10 09:28:01 +01:00
parent b48c716155
commit d1bdc286ba
2 changed files with 21 additions and 1 deletions

View file

@ -54,8 +54,24 @@ if (
/** /**
* Session * Session
*/ */
$sessionLifetime = 2592000; // 1 Month
session_set_cookie_params($sessionLifetime, '/');
session_start(); session_start();
/** Refresh lifetime */
$session = session_get_cookie_params();
setcookie(
session_name(),
session_id(),
time() + $sessionLifetime,
$session['path'],
$session['domain'],
$session['secure'],
$session['httponly']
);
/** /**
* API * API
*/ */

View file

@ -124,7 +124,11 @@ class Page
'register', 'register',
'install' 'install'
); );
if (!isset($_SESSION['user']) && isset($_GET['page']) && !in_array($_GET['page'], $disableRedirect)) { if (
!isset($_SESSION['user'])
&& isset($_GET['page'])
&& !in_array($_GET['page'], $disableRedirect)
) {
header('Location: /?page=login'); header('Location: /?page=login');
die(); die();
} }