[eluser]Unknown[/eluser]
Code:
function login($user, $password)
{
$this -> db -> select('*');
$this -> db -> from('tableName');
$this -> db -> where('user', $user);
$this -> db -> where('password', sha1($this->salt.$password));
$this -> db -> limit(1);
$query = $this -> db -> get();
if($query -> num_rows() == 1)
{
return $query->result();
}
else
{
return false;
}
}
This doesn't work. The password returns as invalid the entire time, or it just doesn't log me in. What am i doing wrong? The salt is stored in the database and i need to retrieve it, add it to the user provided password and then hash it. Please dont lecture on the hashing types, i am fully aware and unfortunately changing from sha to md5 is not an option.