-1
How do I login with the entire encrypted password ?
I used password_hash
and now for me to log in as I do ?
if(isset($_POST['loggin']))
{
$user = trim(strip_tags($_POST['user']));
$txtpassword = $_POST['password'];
$select = "SELECT id, user, password FROM users WHERE BINARY user=:user";
$result = $conexao->prepare($select);
$result->bindParam(':user', $user, PDO::PARAM_STR);
$result->execute();
if($result->rowCount() == 1)
{
$show = $result->fetch(PDO::FETCH_ASSOC);
$idSession = $show['id'];
$passwordHash = $show['password'];
}
if (password_verify($txtpassword, $passwordHash))
{
$_SESSION['userId'] = $idSession;
header("Location: ?p=home");
die();
}
else
{
echo '<script language= "javascript">
location.href="?p=sign_in&action=error_sign_in";
</script>';
}
}
Where do I put this if
– William Alvares
@Williamalvares in the place where you want to check if the password matches or not with the bank. This should already solve your problem.
– Wallace Maxters
Your code will change a lot, following your logic, it would be where the redirect happens if the user is legitimate or not. Replace from where your if ($Count == 1)...'.
– Fabiano Monteiro
@fabianophp edited the post looks there as I did.. yet it gives an error that could not see
– William Alvares
Ah the error that gives is the passwordHash, n will get nothing for the user t t logged in.. q my stupidity..
– William Alvares
All right, I got
– William Alvares
@Good. Don’t forget to accept it as the correct answer to your question.
– Fabiano Monteiro