Hello. When sampling from the user database, BINARY is used.

db_query="select * from ".DB_PREF."users where BINARY name_user='".codeText($name_user)."' and BINARY password_user='".md5($password_user)."' "; 

Explain why it is necessary and what risks, if removed (will not take into account the register)?

  • most likely it was written by a very inexperienced developer (there is no space before "users - bad style, md5($password) - they haven’t written like that for a hundred years (your users' passwords are vulnerable to selection). Since it’s unknown what the noob was guided by, I advise you to remove In theory, everything should still work very badly - strangeqargo

1 answer 1

Here is a note in the manual , this is an abbreviated syntax for CAST(str AS BINARY)

In particular, yes, case-sensitive search. Pay more attention to the handling of trailing spaces. In this case, the field is considered as calculated, i.e. it becomes impossible to use indexes on these fields.