Welcome Guest, Not a member yet? Register   Sign In
Session express when I use ajax imap
#1

Hello,

I use ajax to call some imap functions how ever the session tends to expire before the sess_expiration 7200 limit.

I am not sure if it is some thing to do with session_time_to_update?

Any suggestions what I should change?


PHP Code:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = BASEPATH 'cache/admin/session/';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = TRUE
Reply
#2

The session expiration time.

There is also a CodeIgniter method for checking Ajax calls.

PHP Code:
if (is_ajax_request())
{
 
   // This is a Ajax Request
}
else
{
 
   // This is a Normal Request

What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

you can basically disable the session updates when AJAX calls are made. This code should go in /application/libraries/MY_Session.php
 <?php
class MY_Session extends CI_Session {

    /**
     * Update an existing session
     *
     * @access    public
     * @return    void
    */
    function sess_update() {
       // skip the session update if this is an AJAX call! This is a bug in CI; see:
       // https://github.com/EllisLab/CodeIgniter/issues/154
       // http://codeigniter.com/forums/viewthread/102456/P15
       if ( !($this->CI->input->is_ajax_request()) ) {
           parent:Confusedess_update();
       }
    }
}
Reply




Theme © iAndrew 2016 - Forum software by © MyBB