Hi,
I am doing my login form with password_verify and things are not good…it is like the password_verify is not working…it always says the password is wrong…here is my code and db design…can somebody assist…because i just cannot figure out the issue. Thanks.
[php] id name(char100) email(unique) password(char-255)[/php]
[php] <?php
include_once ‘clean_valeur.inc.php’;
if (isset($_GET[‘connection’])) {
if (isset($_POST[‘submit’])) {
$email="";$password="";$error1="";$error2="";$error3="";
if (empty($_POST[‘email’]))
{
$error1 = “Entrer votre email”;
}
elseif(filter_var($_POST[‘email’], FILTER_VALIDATE_EMAIL)=== FALSE)
{
$error1= “Votre email n’ est pas valide”;
}
else
{
$email = nettoye(($_POST[‘email’]));
}
if (empty($_POST[‘pwd’])) {
$error2 = “Entrer votre mot de passe”;
}
else
{
$password=nettoye(($_POST[‘pwd’]));
}
if ($email =="" OR $password=="") {
$error3= "Votre connection a échoué ";
include_once’Connecter.html.php’;
exit();
}
else
{
include_once"…/includes/connect.inc.php";
try {
$sql = "SELECT * FROM user_registration WHERE email = :email ";
$s = $pdo->prepare($sql);
$s->bindValue(’:email’, $_POST[‘email’]);
$s->execute();
if ($s->rowCount() === 1) {
$row = $s->fetch(PDO::FETCH_ASSOC);
if (password_verify($password, $row[‘password’])) {
header ("Location:home.html.php");
exit();
}
}
else
{
echo “Wrong values”;
}
}
catch (PDOException $e)
{
$errorinsert = “Une situation inattendu est survenu”.$e->getMessage();
}
}
}
include_once’connecter.html.php’;
}[/php]