From 24634046428a423bcb371af50523d82bfb3c3a92 Mon Sep 17 00:00:00 2001 From: niekt0 Date: Wed, 6 Apr 2011 00:03:59 +0200 Subject: [PATCH] logout idle fix (moved to constants) --- wwwroot/inc/logout_idle.inc | 8 +++++++- wwwroot/inc/senate.inc | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/wwwroot/inc/logout_idle.inc b/wwwroot/inc/logout_idle.inc index 8b5abb4..70955ef 100644 --- a/wwwroot/inc/logout_idle.inc +++ b/wwwroot/inc/logout_idle.inc @@ -1,7 +1,13 @@ = (time() - 60*60)) { //TODO predelat timeout do konstanty v nastaveni + +// Logout user, if idle for more then LOGOUT_IDLE_SEC seconds + +if (( !isset($_SESSION['last_request'] ) || + ( $_SESSION['last_request'] >= (time() - LOGOUT_IDLE_SEC))) { $_SESSION['last_request'] = time(); } else { require_once(INCLUDE_DIR."eventz/logout.inc"); logout(); } + +?> diff --git a/wwwroot/inc/senate.inc b/wwwroot/inc/senate.inc index f99800d..3dd4976 100644 --- a/wwwroot/inc/senate.inc +++ b/wwwroot/inc/senate.inc @@ -2,6 +2,9 @@ define('DAILY_K',30); define('REGISTRATION_VOTES',2); //too small so far +// logout after one hour +define('LOGOUT_IDLE_SEC', 3600); + // An attempt to remove hard-code constants from code define('REGISTRATION_TEXT_NODE',791946); define('REGISTRATION_REQUEST_NODE',2091448); -- 2.30.2