19.04.2017, 11:32
This is my little attempt to make a UCP for sa-mp using sha-256
The php hash function for sha-256 generate lower-case letter , but sa-mp generate upper-case letter at hash, so you need to make the php hash upper-case to match the input and the password from databse
The php hash function for sha-256 generate lower-case letter , but sa-mp generate upper-case letter at hash, so you need to make the php hash upper-case to match the input and the password from databse
PHP код:
$row = $stmt->fetch();
if($row)
{
// Using the password submitted by the user and the salt stored in the database,
// we now check to see whether the passwords match by hashing the submitted password
// and comparing it to the hashed version already stored in the database.
$check_password = hash('sha256', $_POST['password'] . $row['salt']);
if(strtoupper($check_password) === $row['password'])
{
// If they do, then we flip this to true
$login_ok = true;
}
}