I want users to enter one of 4 passwords to get access to my site. The landing page is index.html and the redirect page should be home.html
I used the following code and I am using an if statement to hash the entered password and compare it with the 4 acceptable hases. If they match then I want the page to redirect. Otherwise I want to display a JS alert.
My issue is that even if the wrong password is entered, it still redirects with no alert.
//Take the values from the html form and assign them to variables
$ID = $_POST['name'];
$userpassword = $_POST['password'];
//Check to see if the password matches the hashes
if (md5($userpassword) === '5b5c45f1b9e444d9e441211cfb325270'
or '17434cf0d4ba816cd776ff8b0ec532f1'
or '7a94fda2a6e81a1693533e6dc8501b37'
or '2d8b2ba14eeb0ac1fe474d468b720771')
{
//Add the visitor name to our list
mysqli_query($connect, "INSERT INTO `visitor list` (`Visitor Name`) VALUES ('$ID')") or die("Error in INSERT: ".mysqli_error($connect));
echo "You have entered the correct password, congrats.";
// Redirect them to rest of site
header("Location: http://localhost:82/home.html");
die();
}
else {
echo "<script type='text/javascript'>alert('Wrong Password');</script>";
}