I have a log-in file with:
....
$_SESSION['loggedin'] = true;
$_SESSION['username'] = $username;
$_SESSION['start'] = time();
$_SESSION['expire'] = $_SESSION['start'] + (2592000);
...
And I have other file (when I log in correctly) with:
$now = time();
if($now > $_SESSION['expire']) ...
When I correctly enter an user and password from my database, I declare SESSION['EXPIRE'] with the aim of having the session expire within 1 month. I know this would work if I left the page open for 1 month. But if I close the browser and reopen it, SESSION['EXPIRE'] is not saved and therefore is automatically disconnected from the session. What can I do so that when I close the browser and reopen it, I still have the variable?