• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AJAX calls kill sesion

#1
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 :
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?
Reply


Messages In This Thread
AJAX calls kill sesion - by dansanti - 12-15-2014, 12:44 PM
RE: AJAX calls kill sesion - by albertleao - 12-15-2014, 01:58 PM
RE: AJAX calls kill sesion - by dansanti - 12-15-2014, 02:15 PM
RE: AJAX calls kill sesion - by InsiteFX - 12-15-2014, 02:47 PM
RE: AJAX calls kill sesion - by dansanti - 12-15-2014, 02:55 PM
RE: AJAX calls kill sesion - by InsiteFX - 12-16-2014, 05:15 AM
RE: AJAX calls kill sesion - by drhouse7x - 12-16-2014, 05:19 AM
RE: AJAX calls kill sesion - by dansanti - 12-16-2014, 01:28 PM
RE: AJAX calls kill sesion - by Narf - 12-16-2014, 01:44 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.