Welcome Guest, Not a member yet? Register   Sign In
Session expiring before expiration period.
#1

My sessions seem to be expiring before their expiration period. I've researched this quite a lot and am unable to resolve it. I thought may it was down to Asynchronous ajax calls (session race condition) so I extended the session class via MY_Sesssion.php to only regenerate the session if it's not an AJAX call. 

I've included both that function and my config below. I'm using CI version 3.1.7

PHP Code:
class MY_Session extends CI_Session {

 
   // --------------------------------------------------------------------

 
   /**
     *
     * Do not update an existing session on ajax or xajax calls
     *
     * @access    public
     * @return    void
     */
 
   public function sess_regenerate() {
 
       $CI get_instance();

 
       if ( ! $CI->input->is_ajax_request())
 
       {
 
           parent::sess_regenerate();
 
       }
 
   }


Config:
PHP Code:
$config['sess_expiration']        = 7200//= 2 hours
$config['sess_driver'                 'database';
$config['sess_save_path']        = 'ci_session';
$config['sess_table_name']        = 'ci_session';
$config['sess_match_ip']        = FALSE;
$config['sess_time_to_update'         300// 300 = 5 minutes
$config['sess_regenerate_destroy'     TRUE
Reply


Messages In This Thread
Session expiring before expiration period. - by alan1o - 08-16-2018, 07:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB