From 8f1829e3f1b016133a786cb8179fe03d4832e5ca Mon Sep 17 00:00:00 2001 From: Matthias Kalb Date: Fri, 26 Oct 2018 19:04:49 +0200 Subject: [PATCH 1/3] added removal of expired sessions on check for valid session --- php/auth.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/php/auth.php b/php/auth.php index e30c289..7672ae6 100644 --- a/php/auth.php +++ b/php/auth.php @@ -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")) From db2ee7169f6422f284181135ffdbd64415b8ce4e Mon Sep 17 00:00:00 2001 From: Matthias Kalb Date: Fri, 26 Oct 2018 19:05:16 +0200 Subject: [PATCH 2/3] removed event from installation routine --- install/install_action.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/install/install_action.php b/install/install_action.php index 3849e0a..fee8777 100644 --- a/install/install_action.php +++ b/install/install_action.php @@ -217,13 +217,6 @@ INSERT INTO `Einheit` (`ID`, `Name`, `Standard`) VALUES (11, 'Glas', 0);"); -array_push($SQLStatements, " -CREATE EVENT hourly_session_cleanup -ON SCHEDULE EVERY 1 HOUR -DO - DELETE FROM `sessions` WHERE `expires` < NOW();"); - - foreach($SQLStatements as $statement){ $result = $connection->query($statement); } From 9db320ebff4957dec730b401fa9d7fc695cc01bf Mon Sep 17 00:00:00 2001 From: Tim Krehan Date: Fri, 26 Oct 2018 19:42:57 +0200 Subject: [PATCH 3/3] removed unnessesary creation of a table --- install/install_action.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/install/install_action.php b/install/install_action.php index fee8777..a6cd929 100644 --- a/install/install_action.php +++ b/install/install_action.php @@ -107,24 +107,12 @@ CREATE TABLE `RezeptZutat` ( `Zutat` int(11) NOT NULL );"); -array_push($SQLStatements, " -CREATE TABLE `ViewEinkauf` ( - `ID` int(11), - `Anzahl` double, - `Einheit` varchar(255), - `Name` varchar(255), - `Erledigt` tinyint(1) -);"); - array_push($SQLStatements, " CREATE TABLE `Zutat` ( `ID` int(11) NOT NULL, `Name` varchar(255) NOT NULL );"); -array_push($SQLStatements, " -DROP TABLE IF EXISTS `ViewEinkauf`;"); - array_push($SQLStatements, " CREATE VIEW `ViewEinkauf` AS select `Einkauf`.`ID` AS `ID`,`Einkauf`.`Anzahl` AS `Anzahl`,`Einheit`.`Name` AS `Einheit`,`Einkauf`.`Name` AS `Name`,`Einkauf`.`Erledigt` AS `Erledigt` from (`Einkauf` join `Einheit` on((`Einkauf`.`Einheit` = `Einheit`.`ID`))) ;"); @@ -189,7 +177,7 @@ ALTER TABLE `users` "); array_push($SQLStatements, " -ALTER TABLE `sessions` +ALTER TABLE `sessions` ADD CONSTRAINT `fk_session_uid` FOREIGN KEY (`user`) REFERENCES `users` (`uid`);"); array_push($SQLStatements, "