0
I’m logging in to my website but when I use one query
to remove the DB password it comes in a hash and my doubt and how can I hash the passoword that the user put and bought with the DB? To register the password I used the following code PASSWORD(password_inserida_pelo_utilizador)
of MYSQL
.
My password for the login part:
if ($verified === "false") {
$link = mysqli_connect($Host, $UserName, $Password, $DataBaseName);
$query = "SELECT Password FROM Users WHERE Username = '{$username}'";
$result = $link->query($query);
$query_password = array();
if (mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_array($result);
array_push($query_password, $row);
print_r($query_password);
} else {
if ($DEBUG === True) {
echo "Error: " . $query . "<br>" . $link->error;
$verified = "true";
$usernameLoginErr = "Username is incorrect";
} else {
$verified = "true";
$usernameLoginErr = "Username is incorrect";
}
}
$link->close();
}
}
Note: In case there is a safer way to encrypt passwords I am always open to new options.
Why your password(
$query_password
) is an array since the result ofpassword_hash
is a string?– Augusto Vasques