summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2010-09-02 17:32:07 +0200
committerDerek Jones <derek.jones@ellislab.com>2010-09-02 17:32:07 +0200
commiteaa71ba1c19538af5416dceec288aa37cad2b7e6 (patch)
tree8c1449679273e5252f844b0f0214285fb965bc06 /system
parent95e05a0d51c034523fab629357e5fc9c065ecd58 (diff)
Added a new config item to the Session class (sess_expire_on_close) to allow sessions to auto-expire when the browser window is closed.
Diffstat (limited to 'system')
-rw-r--r--system/libraries/Session.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index f413c0d1b..fc3ee0542 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -30,6 +30,7 @@ class CI_Session {
var $sess_use_database = FALSE;
var $sess_table_name = '';
var $sess_expiration = 7200;
+ var $sess_expire_on_close = FALSE;
var $sess_match_ip = FALSE;
var $sess_match_useragent = TRUE;
var $sess_cookie_name = 'ci_session';
@@ -655,12 +656,14 @@ class CI_Session {
// if encryption is not used, we provide an md5 hash to prevent userside tampering
$cookie_data = $cookie_data.md5($cookie_data.$this->encryption_key);
}
-
+
+ $expire = ($this->sess_expire_on_close === TRUE) ? 0 : $this->sess_expiration + time();
+
// Set the cookie
setcookie(
$this->sess_cookie_name,
$cookie_data,
- $this->sess_expiration + time(),
+ $expire,
$this->cookie_path,
$this->cookie_domain,
0