Welcome Guest, Not a member yet? Register   Sign In
Seemingly random session expiration (SOLUTION)
#4

[eluser]Unknown[/eluser]
[quote author="InsiteFX" date="1288844628"]
Code:
// place at the bottom of application/config/constants.php
// Define Ajax Request
define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');

// save as application/libraries/MY_Session
class MY_Session extends CI_Session {
   /*
    * Do not update an existing session on ajax calls
    *
    * @access    public
    * @return    void
    */
    public function sess_update()
    {
        if ( ! IS_AJAX)
        {
            parent::sess_update();
        }
    }

    function sess_destroy()
    {
        parent::sess_destroy();

        $this->userdata = array();
    }
}

EDITED: 10-05-2010
Forgot the define...

InsiteFX[/quote]

Subscribed just to thank you, just what I needed !


Messages In This Thread
Seemingly random session expiration (SOLUTION) - by El Forum - 11-03-2010, 08:53 PM
Seemingly random session expiration (SOLUTION) - by El Forum - 11-03-2010, 09:23 PM
Seemingly random session expiration (SOLUTION) - by El Forum - 10-05-2012, 09:56 AM
Seemingly random session expiration (SOLUTION) - by El Forum - 10-10-2012, 01:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB