Welcome Guest, Not a member yet? Register   Sign In
redirect issue in my function
#1

Hi all,

I am trying to get the else part of this function to work.

PHP Code:
public function login_user_process(){
 
           
    $data 
= array(
 
       'username' => $this->input->post('username'),
 
       'password' => $this->input->post('password')
 
   );

 
   $this->db->select('*');
 
   $this->db->from('account_user');
 
   $this->db->where('username'$data['username']);
 
   $query $this->db->get();

 
   foreach ($query->result() as $row){
 
   
        $result 
$row->password;

 
       if (password_verify($data['password'], $result)) {
 
           $user_data = array (
 
               'username' => $data['username'],
 
               'logged_in' => true
            
);  

        $this
->session->set_userdata($user_data);
 
       redirect('admin/dashboard');  

        
} else {

 
       echo "error";
 
       redirect('admin/login');
 
       }

 
   }


At the moment if I login correctly it works and lets me in, but if I get it wrong I just get a blank screen and it stays in the function instead of redirecting back to admin/login.

Can anyone help please?

Thanks,
Doomie
Reply


Messages In This Thread
redirect issue in my function - by doomie22 - 03-31-2016, 07:39 AM
RE: redirect issue in my function - by doomie22 - 03-31-2016, 08:08 AM
RE: redirect issue in my function - by PaulD - 03-31-2016, 09:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB