I am trying to cobble together a login script in PHP as a learning project.
This is the code for my database write when the user registers. Both of these values are written to the database.
$this->salt = md5(uniqid());
$this->password = md5($password.$salt);
Upon logging in, the following function is fired.
function challengeLogin($submittedPassword, $publicSalt, $storedPassword){
if(md5($submittedPassword.$publicSalt) == $actualPassword){
return 0;
}else{
return 1;
};
}
Unfortunately, on stepping through my code, the two values have never equaled. Can someone help me understand why?