12-15-2014, 12:44 PM
Hi,
i have 2 sites with codeigniter , and in one of these, have a lot ajax call (like a ajax chat), in this case i have to use a "patch" with :
This solve constantly logouts for a while, but some times take logouts again, and speciallly when a ajax call was perform when i change current tab, and click in another with no site content(in that case logout is inmediatly when performe a ajax).
i Notice that cookie is correctly send it to validate, but the answer come with another cookie (becouse session expires i supost).. any idea?
i have 2 sites with codeigniter , and in one of these, have a lot ajax call (like a ajax chat), in this case i have to use a "patch" with :
PHP Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once SYSDIR . '/libraries/Driver.php';
require_once SYSDIR . '/libraries/Session/Session.php';
require_once SYSDIR . '/libraries/Session/drivers/Session_cookie.php';
class MY_Session_cookie extends CI_Session_cookie
{
public function __construct()
{
parent::__construct();
log_message('info', 'MY_Session_cookie loaded');
}
protected function _sess_update($force = false)
{
// Do NOT update an existing session on AJAX calls.
if ($force || !$this->CI->input->is_ajax_request())
return parent::_sess_update($force);
}
}
/* End of file MY_Session_cookie.php */
/* Location: ./system/libraries/Session/drivers/MY_Session_cookie.php */
This solve constantly logouts for a while, but some times take logouts again, and speciallly when a ajax call was perform when i change current tab, and click in another with no site content(in that case logout is inmediatly when performe a ajax).
i Notice that cookie is correctly send it to validate, but the answer come with another cookie (becouse session expires i supost).. any idea?