13.07.2011, 20:00
Hi all,
I've created a simple register system using Y_INI and Whirlpool.
When i try to register it register my account but when i try to login it says wrong password.
Please help me. here's code:
Sorry for my bad english.
I've created a simple register system using Y_INI and Whirlpool.
When i try to register it register my account but when i try to login it says wrong password.
Please help me. here's code:
pawn Код:
case DIALOG_LOGIN: ShowPlayerDialog( playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "Password","Please write your current password.","Login", "Kick"),
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
case DIALOG_LOGIN2:
{
if (!response) return Kick(playerid);
if (response)
{
if (strlen(inputtext) == 0)
return ShowPlayerDialog(playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "Password","Error!\n{FFFFFF}Please write your current password.","Login", "Kick");
new PlayerFile[13 + MAX_PLAYER_NAME], Password[20 + 1];
format( PlayerFile , sizeof PlayerFile, UserData, Encode( pName( playerid ) ) );
INI_ParseFile( PlayerFile, "ParsePlayerPass", false, true, playerid );
GetPVarString( playerid, "pPass", Password, sizeof Password );
new buf[145];
WP_Hash(buf, sizeof(buf), Password);
if(strcmp(Password, buf, false) == 0)
{
SetPVarInt( playerid, "Logged", 1 );
format( PlayerFile , sizeof PlayerFile, UserData, Encode( pName( playerid ) ) );
INI_ParseFile( PlayerFile, "LoadUser", false, true, playerid, true, false );
SendClientMessage(playerid, -1, ""COL_RED"ACCOUNT: "COL_BLUE"You are now "COL_ORANGE"Registered"COL_BLUE", and have been "COL_ORANGE"Automaticaly "COL_BLUE"logged in");
}
else ShowPlayerDialog(playerid, DIALOG_LOGIN2, DIALOG_STYLE_INPUT, "Wrong password...", "Wrong password!\n{FFFFFF}Please try again.", "Login", "Kick");
}
}