stock RegisterPlayer(playerid, regpass[]) { new query[256], EncryptedPass[130]; WP_Hash(EncryptedPass, sizeof(EncryptedPass), regpass); printf("player pass: %s",EncryptedPass); format(query, sizeof(query), "INSERT INTO users (Name, Password) VALUES ('%s', '%s')", GetName(playerid), EncryptedPass); mysql_query(query); printf("Player ID %d (%s) has been registered", playerid, GetName(playerid)); SendClientMessage(playerid, -1, "Account registered!"); LoginPlayer(playerid); return 1; }
Whenever I join my server under another name, it just overwrites the previous account in the database.
Код:
stock RegisterPlayer(playerid, regpass[]) { new query[256], EncryptedPass[130]; WP_Hash(EncryptedPass, sizeof(EncryptedPass), regpass); printf("player pass: %s",EncryptedPass); format(query, sizeof(query), "INSERT INTO users (Name, Password) VALUES ('%s', '%s')", GetName(playerid), EncryptedPass); mysql_query(query); printf("Player ID %d (%s) has been registered", playerid, GetName(playerid)); SendClientMessage(playerid, -1, "Account registered!"); LoginPlayer(playerid); return 1; } |
query[256]
INSERT INTO users (Name, Password) VALUES ('', '')
id | user | pass |
0 | SomeUser | abcdefghij123456789 |
1 | AnotherUser | 123456789abcdefghij |
2 | SomeUser | SomeUserWithAnotherPass |