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

#10
(12-16-2014, 01:28 PM)Hi, I am new in CI3. My site has ajax called for every 5 sec. It is adopted in an intranet site and only less than 10 active users. To solve this auto logout issue, i just need to put this "MY_Session_cookie.php" under ./system/libraries/Session/drivers/MY_Session_cookie.php, then restart the XMAPP, it will work? dansanti Wrote: well making this file seems to work on CI3, but not fix logout on tabs change (firefox BTW), and this file don't need to be autoloaded, placing this on correct directory, autoload the file.

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);
    }
    
    
// --------------------------------------------------------------------

        /**
        * sess_destroy()
        *
            * Clear's out the user_data array on sess::destroy.
            *
            * @access    public
            * @return    void
            */
        public function sess_destroy()
        {
        $this->userdata = array();

        parent::sess_destroy();
        }

}

/* End of file MY_Session_cookie.php */
/* Location: ./system/libraries/Session/drivers/MY_Session_cookie.php */ 
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
RE: AJAX calls kill sesion - by rexcheung727 - 11-08-2020, 07:21 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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