24.12.2018, 20:09
Hello, I have a problem with the user identification when it connects, the problem is that a user registers normal, example, with the name "Samp", then the player leaves and another user enters with the name "samp", then the server recognizes it as the previous user, by this I mean that it does not detect minuscule and capital letters in the name. And then the "samp" player inherits all the data of the "Samp" player
Another example: Name: Samp (admin), "Samp" leaves the server and another user enters with the name "Samp." (It has a point at the end), The server does not ask password to that user and automatically passes the login and gives all the data of the other player (the admin)
I use SQLite.
Another example: Name: Samp (admin), "Samp" leaves the server and another user enters with the name "Samp." (It has a point at the end), The server does not ask password to that user and automatically passes the login and gives all the data of the other player (the admin)
I use SQLite.
PHP Code:
//OnPlayerConnect
new DBResult:Result, DB_Query[140];
format(DB_Query, sizeof(DB_Query), "SELECT `p_pass`, `p_salt` FROM `players` WHERE `p_name` = '%q'", pInfo[playerid][NAME]);
Result = db_query(b_db, DB_Query);
if(db_num_rows(Result)) //registered user
{
db_get_field_assoc(Result, "PASS", pInfo[playerid][PASS], 64 + 1);
db_get_field_assoc(Result, "SALT", pInfo[playerid][SALT], 16);
pInfo[playerid][p_Registered] = true; //confirms that the player is registered
ShowPlayerDialog(playerid, dialog_login, DIALOG_STYLE_INPUT,"LOGIN","enter your password.", "login", "exit");
}
else //Unregistered user
{
SendClientMessage(playerid, -1, "{FFFFFF}Welcome to server");
}
db_free_result(Result);