In my codeigniter php login form i'm facing these issues.Password is encrypted in the database.I'm going to decrypt it from the database and allow login.I checked where is the problem.I could find it's in decrypt part.So if anyone can help me i really appreciate that.This is my code.
Model
function userLoginAuthentication($logindata){
$emailentered=$logindata['email'];
$passwordentered=$logindata['password'];
$passwordget = "SELECT password FROM `users` WHERE email=?";
$passwordgotdatabase=$this->db->query($passwordget,$emailentered);
$passworddecrypted=$this->encrypt->decode($passwordgotdatabase);
$useractivatedget="SELECT is_activated FROM `users` WHERE email=?";
$useractivatedgetdatabase=$this->db->query($useractivatedget,$emailentered);
if ($passwordentered==$passworddecrypted && $useractivatedgetdatabase=1) {
redirect(base_url().'Index/userLoginSuccess');
return TRUE;
}
else{
redirect(base_url().'Index/userLoginRedirection');
return FALSE;
}
}
Controller
public function userLogin()
{
$this->load->view('header');
$this->load->view('userLogin');
if($_POST) {
$logindata=array(
'email'=>$_POST['email'],
'password'=>$_POST['password']
);
$login_confirm=$this->indexModel->userLoginAuthentication($logindata);
if ($login_confirm){
echo 'USER PROFILE';
}
else {
echo 'TRY AGAIN';
}
}
$this->load->view('footer');
}