Support path (default /) and lifetime (default 24 hours) for the session
authorJoey Schulze <joey@infodrom.org>
Thu, 24 Mar 2011 20:34:14 +0000 (21:34 +0100)
committerJoey Schulze <joey@infodrom.org>
Thu, 24 Mar 2011 20:34:14 +0000 (21:34 +0100)
config.php.template
init.php

index cfa2887..d5eed23 100644 (file)
@@ -4,6 +4,10 @@ define('TITLE', 'Infodrom Administration');
 define('PAGETITLE', 'Infodrom Hallinta');
 
 define('SESSION_NAME', 'HALLINTA');
+# Cookie path, defaults to /
+# define('SESSION_PATH', '/hallinta/');
+# Cookie lifetime, defaults to 24 hours
+# define('SESSION_LIFETIME', 60*60*2);
 
 # defaults to images/login.jpg
 # define('LOGIN_IMG', 'images/login_neu.jpg');
index 1e647be..0aba532 100644 (file)
--- a/init.php
+++ b/init.php
@@ -2,7 +2,11 @@
 
 require_once('config.php');
 
+if (!defined('SESSION_PATH')) define('SESSION_PATH', '/');
+if (!defined('SESSION_LIFETIME')) define('SESSION_LIFETIME', 60*60*24);
+
 session_name(SESSION_NAME);
+session_set_cookie_params(SESSION_LIFETIME, SESSION_PATH);
 session_start();
 
 require_once('lib/general.php');