2

I created login feature and need to check the email & password input by user. I don't know what's going on with my code, because it was work before I changed the "$user_pass" (before: $user['user_pass']).It shows ParseError, syntax error, unexpected ';' on line:

$data = [
          'email' => $user['user_email'],
          'role_id' => $user['role_id']
        ];

here is full code of checking password:

if ($user) {
   if (password_verify($password, $user_pass) {
   $data = [
    'email' => $user['user_email'],
    'role_id' => $user['role_id']
   ];
$this->session->set_userdata($data);
redirect('admin/dashboard');
} else {
   $this->session->set_flashdata('message', '<div class="alert alert-danger" role="alert">Wrong password!</div>');
   redirect('admin');
   }     
} else {
   $this->session->set_flashdata('message', '<div class="alert alert-danger" role="alert">Email is not registered!</div>');
   redirect('admin');
  }
}
Mate
  • 4,976
  • 2
  • 32
  • 38

1 Answers1

1

missing ) after $user_pass) , must be

   if (password_verify($password, $user_pass))
Mate
  • 4,976
  • 2
  • 32
  • 38