From: Michael Rasmussen Date: Sat, 6 Jun 2015 10:23:18 +0000 (+0200) Subject: Add check for valid session X-Git-Url: http://git.datanom.net/qtadmin.git/commitdiff_plain/07124c3728ccb26c74cc18b0c8ff93a92bf28551 Add check for valid session --- diff --git a/js/timer.js b/js/timer.js index f68f084..1017271 100644 --- a/js/timer.js +++ b/js/timer.js @@ -17,14 +17,14 @@ function myTimer() { if (timeLeft < last || last == -1) { last = timeLeft; timeLeft = '< ' + timeLeft + ' min'; - console.log('Session soon to expire'); + /*console.log('Session soon to expire');*/ document.getElementById("time").style.background = "red"; document.getElementById("timer").innerHTML = timeLeft; } } else { if ((timeLeft < last && timeLeft > 0) || last == -1) { last = timeLeft; - console.log('Session valid < ' + timeLeft); + /*console.log('Session valid < ' + timeLeft);*/ timeLeft = '< ' + timeLeft + ' min'; document.getElementById("timer").innerHTML = timeLeft; } diff --git a/lib/utils.inc.php b/lib/utils.inc.php index 3c3ff97..dcdd851 100644 --- a/lib/utils.inc.php +++ b/lib/utils.inc.php @@ -143,7 +143,8 @@ class Utils { $time = $_SERVER['REQUEST_TIME']; if (isset($_SESSION['LAST_ACTIVITY']) && ($time - $_SESSION['LAST_ACTIVITY']) >= $this->settings['timeout']) { - echo 'R_TIME: '.date('c', $time).' L_ACT: '.date('c', $_SESSION['LAST_ACTIVITY']); + $this->log('R_TIME: '.date('c', $time).' L_ACT: '.date('c', $_SESSION['LAST_ACTIVITY']. + 'Test: '.($time - $_SESSION['LAST_ACTIVITY'])).' >= '.$this->settings['timeout'], 3); $this->logout(); } else { $_SESSION['LAST_ACTIVITY'] = $time;