Welcome Guest, Not a member yet? Register   Sign In
Issue with Sessions! How to keep the user login forever
#1

Hi;

I use CI database for sessions (and user's auth).

1 - I was wondering how I can get the users to be logged in forever.
2 - Let's say user logs in and stays idle for 15 min. If I reload a page (with Ajax or Jquery) that requires the user to be logged in, it logs the user out and says the user is not logged in. How can I do it so once the user logs in, I'd be able to make ajax calls at any time without having to re login.


This is my config:

PHP Code:
$config['sess_cookie_name'] = 'ci_session_web';
$config['sess_expiration'] = 7200;
$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

This is how I log them in:

PHP Code:
$newdata = array('username'  => $data['member_details'][0]->first_name,'email'  => $data['member_details'][0]->email'member_id'  => $data['member_details'][0]->id'logged_in' => TRUE);
$this->session->set_userdata('logged_data'$newdata); 

This is how I check if the user is logged in or not.
PHP Code:
if(isset($this->session->userdata['logged_data']['logged_in'])) 

Thanks
Reply


Messages In This Thread
Issue with Sessions! How to keep the user login forever - by behnampmdg3 - 12-13-2015, 10:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB