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

Hello there guys, im having a basic problem with the session expire

What im intent to do is when the session expires auto logout the user.

This is the code for the login page which sets the session.
PHP Code:
$result $this->db->query("SELECT * FROM rulers WHERE username = '".$username."' AND password = '".$pass."'");
        
$row $result->row();

        
$time $this->session->sess_expiration 10;
        
$userdata = array(
            
'user_id'                  =>$row->id,
            
'username'              =>$row->username,
            
'time'                    =>$time,
            
'Administration_login'    => true
        
);
        
        
$this->session->set_userdata($userdata); 

And this is the check code

PHP Code:
$login $this->session->get_userdata('time');
        
 
       if($login == 0){
 
           $this->session->sess_destroy();
 
           redirect('Administration/Login','Location');
 
       
Reply
#2

You can't set sess_expiration like that ... It has to be in the config file.
Reply
#3

(02-05-2016, 11:23 AM)Narf Wrote: You can't set sess_expiration like that ... It has to be in the config file.

thanks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB