I am having a little trouble with a login script. You can probably tell im pretty new to this. I have troubleshooted the problem to being in the if(password_verify) statement! All help is appreciated, and please critique anything if noticed!
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
session_start();
$email = $_POST["email"];
$password = $_POST["password"];
require '../../usersTable.php';
$stmt_check = $conn->prepare("SELECT * FROM users WHERE email=?");
$stmt_check->bind_param("s", $email);
$stmt_check->execute();
if ($stmt_check->num_rows > 0) {
if (password_verify($password, $row['password'])) {
$conn->close();
// Success!
header('Location: ../')
} else {
$conn->close();
// Invalid credentials
echo 'Password Mismatch';
}
} else {
$conn->close();
echo "incorrect Email!";
}
$row['password']isn't a copy+paste error; it looks like you don't declare$rowanywhere.;afterheader('Location: ../'). This will give you a syntax error.exit()afterheader('Location: ...');