From 07d05a65a493a0c9d03a803241fdebfeb13b1af0 Mon Sep 17 00:00:00 2001 From: Eike Foken Date: Wed, 10 Aug 2011 03:18:40 +0200 Subject: [PATCH] Do not update sessions on ajax calls --- application/libraries/MY_Session.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/application/libraries/MY_Session.php b/application/libraries/MY_Session.php index 58c9f97..e7e1e80 100644 --- a/application/libraries/MY_Session.php +++ b/application/libraries/MY_Session.php @@ -47,6 +47,12 @@ class MY_Session extends CI_Session { * Updates an existing session. */ public function sess_update() { + // skip the session update in case of an ajax call + if ($this->CI->input->is_ajax_request()) { + return; + } + + // we only update the session every five minutes by default if ($this->userdata['last_activity'] + $this->sess_time_to_update >= $this->now) { return; }