I\'m trying to figure out how to use password_hash on register and login systems.
Currently I\'m using password_hash like this to register my users.
$pas
Ok I made this work with password_verify()
$usuario = $_POST["Nick"];
$contra = $_POST["Pass"];
$stmt = $conn->prepare("SELECT Nick, Password FROM usuario WHERE Nick = ?");
$stmt->bind_param( "s", $usuario);
$stmt->execute();
$stmt->store_result();
$stmt->bind_result($a, $b);
if($stmt->fetch() == 0){
header("Location: ../Entrar.php?message=Error");
exit();
}
else {
if(password_verify($contra, $b)) {
session_start();
$_SESSION['Usuario'] = $a;
$_SESSION['estado'] = 'Autenticado';
header("Location: ../../Index.php");
exit;
}
else{
header("Location: ../Entrar.php?message=Error");
exit;
}
}
Thank you for all those comments. And yes martinstoeckli that was the answer to my question thank you