Welcome Guest, Not a member yet? Register   Sign In
CI 3 RC Sessions: mark_as_temp()
#6

Hi Narf!

Thanks very much for the feedback, i have read the link you provided. it was very helpful clearing my mind about useful and un-secure strategies.

but the solution provided there, it might help me in future when i'm making a very secure project and if that's the demand of the client.

but as of now, i don't want to store my sessions information in database, especially not for the backend. it will really helpful if you can give your insight on my below settings and coding.

1. I'm autoloading 'session' libaray in my project like this:
Code:
$autoload['libraries'] = array('database', 'session');

2. My config is like this:
Code:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 86400;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
^ i have decided to set the sess_expiration to 1 day for both my front-end and back-end users generally.

3. my Login_model does this, besides other things:
Code:
if ($remember_me) {
       $this->session->set_userdata($data);
     }else{
       $expire = 3600;
       $this->session->set_userdata($data);
       $this->session->mark_as_temp('admin_id', $expire);
       $this->session->mark_as_temp('username', $expire);
       $this->session->mark_as_temp('first_name', $expire);
       $this->session->mark_as_temp('last_name', $expire);
       $this->session->mark_as_temp('logged_in', $expire);
       //$this->session->mark_as_temp($data, $expire);
       //$this->session->set_tempdata($data, NULL, $expire);
     }

this is working somewhat for what i wanted in previous post, can you guide if this is the right approach or am i doing something wrong. for some reason last two commented lines in else case are not working and i have to set tempdata one by one on each variable.
Reply


Messages In This Thread
CI 3 RC Sessions: mark_as_temp() - by summer - 02-02-2015, 12:36 AM
RE: CI 3 RC Sessions: mark_as_temp() - by summer - 02-02-2015, 01:11 PM
RE: CI 3 RC Sessions: mark_as_temp() - by Narf - 02-02-2015, 02:23 PM
RE: CI 3 RC Sessions: mark_as_temp() - by summer - 02-03-2015, 12:00 AM
RE: CI 3 RC Sessions: mark_as_temp() - by Narf - 02-03-2015, 02:08 AM
RE: CI 3 RC Sessions: mark_as_temp() - by summer - 02-03-2015, 03:35 AM
RE: CI 3 RC Sessions: mark_as_temp() - by Narf - 02-03-2015, 03:48 AM
RE: CI 3 RC Sessions: mark_as_temp() - by summer - 02-03-2015, 04:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB