summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Session/drivers/Session_cookie.php9
-rw-r--r--system/libraries/Session/drivers/Session_native.php6
2 files changed, 14 insertions, 1 deletions
diff --git a/system/libraries/Session/drivers/Session_cookie.php b/system/libraries/Session/drivers/Session_cookie.php
index 7174d63c8..d3d22d03a 100644
--- a/system/libraries/Session/drivers/Session_cookie.php
+++ b/system/libraries/Session/drivers/Session_cookie.php
@@ -402,6 +402,7 @@ class CI_Session_cookie extends CI_Session_driver {
// Is the session data we unserialized an array with the correct format?
if ( ! is_array($session) OR ! isset($session['session_id'], $session['ip_address'], $session['user_agent'], $session['last_activity']))
{
+ log_message('debug', 'Session: Wrong cookie data format');
$this->sess_destroy();
return FALSE;
}
@@ -409,6 +410,7 @@ class CI_Session_cookie extends CI_Session_driver {
// Is the session current?
if (($session['last_activity'] + $this->sess_expiration) < $this->now OR $session['last_activity'] > $this->now)
{
+ log_message('debug', 'Session: Expired');
$this->sess_destroy();
return FALSE;
}
@@ -416,6 +418,7 @@ class CI_Session_cookie extends CI_Session_driver {
// Does the IP match?
if ($this->sess_match_ip === TRUE && $session['ip_address'] !== $this->CI->input->ip_address())
{
+ log_message('debug', 'Session: IP address mismatch');
$this->sess_destroy();
return FALSE;
}
@@ -424,6 +427,7 @@ class CI_Session_cookie extends CI_Session_driver {
if ($this->sess_match_useragent === TRUE &&
trim($session['user_agent']) !== trim(substr($this->CI->input->user_agent(), 0, 120)))
{
+ log_message('debug', 'Session: User Agent string mismatch');
$this->sess_destroy();
return FALSE;
}
@@ -459,6 +463,7 @@ class CI_Session_cookie extends CI_Session_driver {
// No result? Kill it!
if (empty($query) OR $query->num_rows() === 0)
{
+ log_message('debug', 'Session: No match found in our database');
$this->sess_destroy();
return FALSE;
}
@@ -498,6 +503,8 @@ class CI_Session_cookie extends CI_Session_driver {
'last_activity' => $this->now,
);
+ log_message('debug', 'Session: Creating new session ('.$this->userdata['session_id'].')');
+
// Check for database
if ($this->sess_use_database === TRUE)
{
@@ -536,6 +543,8 @@ class CI_Session_cookie extends CI_Session_driver {
{
// Get new id
$this->userdata['session_id'] = $this->_make_sess_id();
+
+ log_message('debug', 'Session: Regenerate ID');
}
// Check for database
diff --git a/system/libraries/Session/drivers/Session_native.php b/system/libraries/Session/drivers/Session_native.php
index fb5ce1906..c237ad059 100644
--- a/system/libraries/Session/drivers/Session_native.php
+++ b/system/libraries/Session/drivers/Session_native.php
@@ -117,18 +117,21 @@ class CI_Session_native extends CI_Session_driver {
if (isset($_SESSION['last_activity']) && (($_SESSION['last_activity'] + $expire) < $now OR $_SESSION['last_activity'] > $now))
{
// Expired - destroy
+ log_message('debug', 'Session: Expired');
$destroy = TRUE;
}
elseif ($config['sess_match_ip'] === TRUE && isset($_SESSION['ip_address'])
&& $_SESSION['ip_address'] !== $this->CI->input->ip_address())
{
// IP doesn't match - destroy
+ log_message('debug', 'Session: IP address mismatch');
$destroy = TRUE;
}
elseif ($config['sess_match_useragent'] === TRUE && isset($_SESSION['user_agent'])
&& $_SESSION['user_agent'] !== trim(substr($this->CI->input->user_agent(), 0, 50)))
{
// Agent doesn't match - destroy
+ log_message('debug', 'Session: User Agent string mismatch');
$destroy = TRUE;
}
@@ -145,9 +148,10 @@ class CI_Session_native extends CI_Session_driver {
&& ($_SESSION['last_activity'] + $config['sess_time_to_update']) < $now)
{
// Changing the session ID amidst a series of AJAX calls causes problems
- if( ! $this->CI->input->is_ajax_request())
+ if ( ! $this->CI->input->is_ajax_request())
{
// Regenerate ID, but don't destroy session
+ log_message('debug', 'Session: Regenerate ID');
$this->sess_regenerate(FALSE);
}
}