Answer the question
In order to leave comments, you need to log in
How to compare API key correctly?
Currently implemented as follows:
$request = "SELECT APIKey, FullName FROM users WHERE UserName = '$USER_NAME'";
if((isset($rs->APIKey) && !empty($rs->APIKey)) && (decrypt($rs->APIKey) == $API_KEY))
{
}
$encAPIKey = encrypt($API_KEY)
and substitute it in the SQL query:$request = "SELECT APIKey, FullName FROM users WHERE UserName = '$USER_NAME' AND APIKey = '$encAPIKey'";
Answer the question
In order to leave comments, you need to log in
Q: Why not useFirstly, this way you will not know what the reason is - in the login or in the password, or in both fields. Secondly, it MAY work with keys, but it doesn’t work like that with passwords, there is a different reconciliation algorithm, and it is advisable not to produce entities and create algorithms that are as close as possible in implementation in similar places.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question