03-31-2016, 07:39 AM
Hi all,
I am trying to get the else part of this function to work.
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
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