12.03.2016, 23:32
Quote:
I couldn't find much on the matter and I never realised it myself, so I'm taking Crayder's word for it.
Are you hashing the user's input in the login dialogue or are you checking the stored password against the user's input in plain text? Keep in mind that the user's password is saved as a hash and the user's input is plain text meaning that you have to hash the user's input and check that hash against the stored one. EDIT: To add to Crayder's recommendation to use SQL, I completely agree. You can go ahead and use file processing as your main medium for storing essential user data and soon realise that it has a lot of restrictions compared to SQL. Nevertheless, it's worth knowing about using file processing this way and it is best understood by practically using it yourself; in my opinion. |
PHP Code:
case DIALOG_LOGIN:
{
if(!response) return Kick(playerid);
else
{
new hashpass[129];
WP_Hash(hashpass, sizeof(hashpass), inputtext);
if(!strcmp(hashpass, PlayerInfo[playerid][Password]))
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login Panel", "{FF6600}You have entered an incorrect password of this account!\nPlease enter the correct password to continue!", "Login", "Quit");
}
else
{
SetPlayerScore(playerid, PlayerInfo[playerid][Score]);
GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]);
SendClientMessage(playerid, GREEN, "[SERVER]: You have successfully logged in! Welcome back");
PlayerInfo[playerid][Authenticated] = true;
TogglePlayerSpectating(playerid, false);
}
return 1;
}
}
}
return 0;
}