16.04.2018, 17:41
Hi, I have a problem with my Register/Login system, register works fine, but when logging in, even tho I write the good password it says it's wrong.Please help me, here's the code.
And
Thank you in advance
Код:
case LoginPassword: { if(!response) return SCM(playerid, COLOR_LIGHTRED, "* Ai primit kick din cauza ca nu ai raspuns la dialog.") && Kick(playerid); if( response ) { new query[100], string[256], hashpass[129]; WP_Hash(hashpass, sizeof(hashpass), inputtext); if(!strcmp(hashpass, PlayerInfo[playerid][pPassword])) { mysql_format(MySQL, query, sizeof(query), "SELECT * FROM `users` WHERE `Name` = '%e' LIMIT 1", GetName(playerid)); mysql_tquery(MySQL, query, "OnAccountLoad", "i", playerid); } else { PasswordIncercari[playerid]--; if(PasswordIncercari[playerid] == 0) { SCM(playerid, COLOR_RED,"* Ai primit kick deoarece nu ai scris parola corecta de multiple ori."); Kick(playerid); printf("[KICK-PASSWORD] %s has been kicked for entering the wrong password 2 times.", GetName(playerid)); } format(string, sizeof(string), "* Ai scris o parola gresita, mai ai %d incercari.", PasswordIncercari); SendClientMessage(playerid, COLOR_RED, string); ShowPlayerDialog(playerid, LoginPassword, DIALOG_STYLE_PASSWORD, "Login", "Bine ai revenit!\nTe rugam sa te loghezi:", "Login.", "Quit."); } } }
Код:
case RegisterPassword: { if(!response) SCM(playerid, COLOR_LIGHTRED, "* Ai primit kick din cauza ca nu ai raspuns la dialog.") && Kick(playerid); if(strlen(inputtext) < 5) { SendClientMessage(playerid, -1, "* Your password must have at least 5 characters."); return ShowPlayerDialog(playerid, RegisterPassword, DIALOG_STYLE_PASSWORD, "Register", "Please fill in your desired password:", "Register", "Quit"); } new query[256]; new IP[16]; GetPlayerIp(playerid, IP, sizeof(IP)); PlayerInfo[playerid][pSkin] = 37; WP_Hash(PlayerInfo[playerid][pPassword], 129, inputtext); mysql_format(MySQL, query, sizeof(query), "INSERT INTO `users` (`Name`, `Password`, `IP`, `Gender`, `Email`, `Skin`) VALUES ('%s', '%e', '%s', 0, 0, '%d')", GetName(playerid), PlayerInfo[playerid][pPassword], IP, 0, 0, PlayerInfo[playerid][pSkin]); mysql_tquery(MySQL, query, "OnAccountRegister", "i", playerid); }