In my functions file I have this code:
function password($password, $dbpassword = false){
if($dbpassword){
$password = mysqli_real_escape_string($GLOBALS["mysqli"], $_POST["$dbpassword"]);
if(empty($password))
$password = mysqli_real_escape_string($GLOBALS["mysqli"], $_GET["$dbpassword"]);
if(empty($password))
return false;
}
$hasher = new PasswordHash(8, false);
if (strlen($password) > 72)
return false;
else{
if($dbpassword){
$check = $hasher->CheckPassword($password, $dbpassword);
if ($check)
return true;
else
return false;
}else{
$hash = $hasher->HashPassword($password);
if (strlen($hash) >= 20)
return $hash;
else
return false;
}
}
}
and in another file (with includes to functions and to the PHPASS php file) I have this code:
$pass = password("Vlad");
if(password("Vlad", $pass)){
echo 11;
}else{
echo 22;
}
It returns 22. Why is that?