Welcome Guest, Not a member yet? Register   Sign In
Session Lost
#1

[eluser]Unknown[/eluser]
Hi, i have a problem with session, after 5 minutes the session is lost, why?
My code check if the user is logged, if not found session, then redirect for login.

My software can't lost this session after 5 minutes, because the users are waiting for incoming chat call.

My Helper: islogged();

Code:
if ( ! function_exists('islogged'))
{
    function islogged()
    {
        $CI         = &get;_instance();
        $codaccount = $CI->session->userdata('codaccount');
        
        if (!$codaccount)
        {
            redirect('/');
        }
    }
}

I call this helper in the construct of my controllers:
Code:
public function __construct() {
        parent::__construct();
        $this->load->model('Chat_Model', 'ChatM');
        $this->codaccount= $this->session->userdata('codaccount');
        islogged();
    }

The config.php

Code:
$config['sess_cookie_name']         = 'ci_session';
$config['sess_expiration']          = 0;
$config['sess_expire_on_close']     = FALSE;
$config['sess_encrypt_cookie']      = FALSE;
$config['sess_use_database']        = TRUE;
$config['sess_table_name']          = 'ci_sessions';
$config['sess_match_ip']            = FALSE;
$config['sess_match_useragent']     = TRUE;
$config['sess_time_to_update']      = 300;
#2

[eluser]appleboy[/eluser]
Hi,

You can try native session library.

https://github.com/appleboy/CodeIgniter-Native-Session
#3

[eluser]jvicab[/eluser]
Look for this line in config.php file: $config['sess_expiration'] and increase the value (in seconds) as desired.




Theme © iAndrew 2016 - Forum software by © MyBB