Hi guys. So I seem to have come across an issue... No matter what password I use, I am logged in to my account. This is the dialog code:
pawn Код:
if(!response)
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "You selected exit, therefore you were kicked.");
Kick(playerid);
}
else if(strlen(inputtext) == 0)
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "You must input the password to your account! If this is not your account, come back with a new name!");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login / Authentication Process", "Hello there!\n\nPlease enter your password to authenticate.", "Login", "Cancel");
}
else
{
new buffer[129];
GetFromAccount(PlayerStatistics[playerid][pUserName], "Password", PlayerStatistics[playerid][pPassword]);
WP_Hash(buffer, sizeof(buffer), inputtext);
if(!strcmp(buffer, PlayerStatistics[playerid][pPassword], false))
{
PlayerStatistics[playerid][pAuth] = 1;
LoadAccountVariables(playerid);
format(string, sizeof(string), "Welcome back, %s! You have successfully authenticated.", GetName(playerid));
SendClientMessage(playerid, COLOR_ORANGE, string);
TogglePlayerSpectating(playerid, false);
SetSpawnInfo(playerid, 0, PlayerStatistics[playerid][pSkin], PlayerStatistics[playerid][pPositionX], PlayerStatistics[playerid][pPositionY], PlayerStatistics[playerid][pPositionZ], 0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
SetPlayerHealth(playerid, PlayerStatistics[playerid][pHealth]);
SetPlayerArmour(playerid, PlayerStatistics[playerid][pArmour]);
SetPlayerScore(playerid, PlayerStatistics[playerid][pScore]);
GivePlayerMoneyEx(playerid, PlayerStatistics[playerid][pMoney]);
// -----[Let's Show Some TD's]----- //
TextDrawShowForPlayer(playerid, Textdraw0);
/*TextDrawShowForPlayer(playerid, Textdraw1);*/
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Incorrect password. Please try again!");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login / Authentication Process", "Hello there!\n\nPlease enter your password to authenticate.", "Login", "Cancel");
}
}
pawn Код:
stock GetFromAccount(user, obtaining[], holdingvar[])
{
format(Query, sizeof(Query), "SELECT `%s` FROM `Accounts` WHERE `UserName` = '%s'", obtaining, user);
mysql_query(Query);
mysql_store_result();
if(mysql_fetch_row(holdingvar) == 1)
{
mysql_free_result();
}
return 1;
}
I'll show you how to fix it, but you must pay me. *giggles.*
im going to try editing mine so it doesn't use password hashing (whirlpool). Just singling things out.