Remember user after logging in
This commit is contained in:
parent
b48c716155
commit
d1bdc286ba
2 changed files with 21 additions and 1 deletions
16
index.php
16
index.php
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue