Welcome Guest, Not a member yet? Register   Sign In
Destroying a session
#8

[eluser]InsiteFX[/eluser]
This is how I do it, change to what you need.
Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
* ------------------------------------------------------------------------
* CI Session Class Extension.
* ------------------------------------------------------------------------
*
* Add the following define to 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');
*
*/

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)
        {
            $this->sess_time_to_update = 300;
            parent::sess_update();
        }
        else
        {
            $this->sess_time_to_update = 1200;
            parenet::sess_update();
        }
    }

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

        $this->userdata = array();
    }

}

// ------------------------------------------------------------------------
/* End of file MY_Session.php */
/* Location: ./application/libraries/MY_Session.php */

InsiteFX


Messages In This Thread
Destroying a session - by El Forum - 12-01-2010, 04:00 AM
Destroying a session - by El Forum - 12-01-2010, 04:06 AM
Destroying a session - by El Forum - 12-01-2010, 05:17 AM
Destroying a session - by El Forum - 12-01-2010, 06:48 AM
Destroying a session - by El Forum - 12-01-2010, 06:51 AM
Destroying a session - by El Forum - 12-01-2010, 07:01 AM
Destroying a session - by El Forum - 12-01-2010, 07:04 AM
Destroying a session - by El Forum - 12-01-2010, 07:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB