mirror of
https://github.com/tim-krehan/shopping-list.git
synced 2024-11-23 22:30:41 +01:00
added removal of expired sessions on check for valid session
This commit is contained in:
parent
aed65dc228
commit
8f1829e3f1
1 changed files with 3 additions and 0 deletions
|
@ -3,6 +3,9 @@
|
|||
include $_SESSION["docroot"].'/php/connect.php';
|
||||
if(!(preg_match("/error.+/", $_SERVER["REQUEST_URI"])))
|
||||
{
|
||||
# clear expired sessions from the database
|
||||
$mysqli->query('DELETE FROM `sessions` WHERE `expires` < NOW();');
|
||||
|
||||
$result = $mysqli->query('SELECT * FROM `sessions` WHERE `session_id` = \''.$_COOKIE["token"].'\';');
|
||||
|
||||
if($result->num_rows == 0 && (!(in_array("site", array_keys($_GET))) || $_GET["site"]!="login"))
|
||||
|
|
Loading…
Reference in a new issue