I wrote php code for my signin.php file and my query works for my username but when i put in the password variable , it doesn't do anything. I want the user to put in a username and password because all they have to put in to get to the restricted page , is a username no password. It checks if the username is in the database table, if it is, it goes to the restricted page. I posted a question like this and i got good answers but i don't know where to put the information , This is my process.php :
<?php
include("db.php");
$username = $_POST['username'];
$pw = $_POST['StorePassword'];
if ( isset( $_POST['login'] ) ) {
$query = mysqli_query($conn, "SELECT * FROM users WHERE username='".$username."' StorePassword='".$pw."' ");
$StorePassword = password_hash($pw, PASSWORD_BCRYPT, array('cost' => 8));
if ( mysqli_num_rows($query) > 0 ) {
while ( $row = mysqli_fetch_assoc( $query ) ) {
if ( $row['StorePassword'] == $pw ) {
header("Location: home.php");
} else {
echo "Wrong password";
}
}
} else {
echo "User not found <br />";
}
if(empty($pw)){
echo"Please enter your password.";
} else{
}
}
?>
<html>
<body>
<a href="signin.php">Please try again</a>
</body>
</html>