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


Messages In This Thread
Session expire - by spyrosjevan - 02-05-2016, 03:06 AM
RE: Session expire - by Narf - 02-05-2016, 11:23 AM
RE: Session expire - by spyrosjevan - 02-12-2016, 11:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB