Automatic idle logout without cron
authorHarvie <tomas@mudrunka.cz>
Tue, 5 Apr 2011 20:49:15 +0000 (22:49 +0200)
committerHarvie <tomas@mudrunka.cz>
Tue, 5 Apr 2011 21:06:44 +0000 (23:06 +0200)
wwwroot/inc/logout_idle.inc [new file with mode: 0644]
wwwroot/nodes.php

diff --git a/wwwroot/inc/logout_idle.inc b/wwwroot/inc/logout_idle.inc
new file mode 100644 (file)
index 0000000..8b5abb4
--- /dev/null
@@ -0,0 +1,7 @@
+<?php
+if(!isset($_SESSION['last_request']) || $_SESSION['last_request'] >= (time() - 60*60)) { //TODO predelat timeout do konstanty v nastaveni
+       $_SESSION['last_request'] = time();
+} else {
+       require_once(INCLUDE_DIR."eventz/logout.inc");
+       logout();
+}
index 490ee443eb077842539ecac9c9e31e7f826a36ce..2bf47a3fdd72f32d2a42202dfb2bb883d3777b1f 100644 (file)
@@ -97,9 +97,11 @@ if ($_SESSION['debugging']) {
 
 //initializing node
 if (!is_numeric($_GET['node_id'])) {
-       $_GET['node_id']=WELCOME_NODE;
+       $_GET['node_id']=WELCOME_NODE; //Tohle uz je v PHP rewritech!!!!
 }
 
+require_once(INCLUDE_DIR.'logout_idle.inc'); //Logout when idle
+
 $node = nodes::getNodeById($_GET['node_id'],(isset($_SESSION['user_id']))?$_SESSION['user_id']:'');
 
 //XXX Paths are wrong (!)
This page took 0.158062 seconds and 4 git commands to generate.