Welcome Guest, Not a member yet? Register   Sign In
AJAX calls kill sesion
#5

(12-15-2014, 02:47 PM)InsiteFX Wrote: This has always worked for me give it a try.


Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
* ------------------------------------------------------------------------
* Created by PhpStorm 8.0.3.
* Date : 5/6/2012
* Time : 11:19:06 PM
* ------------------------------------------------------------------------
*
* Class MY_Session
*
* @package Package CodeIgniter
* @subpackage Subpackage session
* @category category sessions
* @author Raymond L King Sr.
* @link http://example.com
* ------------------------------------------------------------------------
* To change this template use File | Settings | File Templates.
* ------------------------------------------------------------------------
*/

/**
* ------------------------------------------------------------------------
* CI Session Class Extension for AJAX calls.
* ------------------------------------------------------------------------
*
* ====- Save as application/libraries/MY_Session.php -====
*/

class MY_Session extends CI_Session {

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

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

$ajax = $_ci->input->is_ajax_request();

if ($ajax === FALSE)
{
parent::sess_update();
}
   }

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

/**
* 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 Class.

/**
* ------------------------------------------------------------------------
* Filename: MY_Session.php
* Location: ./application/libraries/MY_Session.php
* ------------------------------------------------------------------------
*/
Must be loaded or autoloaded?, and well now i'm using CI3 do you know if work on it?,(by the way i'll test it on CI3 and give a comment)
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



Theme © iAndrew 2016 - Forum software by © MyBB