I have an encrypted password in the database which i am trying to retreive:
Model:
function get_user($usr, $pwd)
{
$encriptKey = 'super-secret-key';
$sql = "
select * from user
where username = '" . $usr . "' and
password = '". $this->encrypt->decode($pwd,$encriptKey) . "'
";
$query = $this->db->query($sql);
return $query->num_rows();
}
and in the controller i have:
$username = $this->input->post("txt_username");
$password = $this->input->post('txt_password');
$usr_result = $this->account_model->get_user($username, $password);
if ($usr_result > 0) //active user record is present
{
//login
}
Why is the password still invalid?