29.07.2015, 10:11
Passwords are not getting compared..If I enter wrong password also in dialog box then also I am able to log in..
PHP код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==DIALOG_REGISTER)
{
if (!response) return Kick(playerid);
if(response)
{
if(strlen(inputtext)<6)
{
new str1[400];
format(str1,sizeof(str1),"{FFFFFF}Your Account Name \"%s\" is not registered. \n\nPlease register your password to save your status\n\nEnter the password Below:\n{B71800}Password must be 6 characters long\n\n",PlayerName(playerid));
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"{007BBE}Registering Panel",str1,"Register","Quit");
}
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
new INI:file = INI_Open(UserPath(playerid));
INI_SetTag(file,"Player's Data");
INI_WriteString(file,"Password",hashpass);
INI_WriteInt(file,"Cash",0);
INI_WriteInt(file,"Score",0);
INI_WriteInt(file,"Kills",0);
INI_WriteInt(file,"Deaths",0);
INI_WriteInt(file,"Admin",0);
INI_WriteInt(file,"VIP",0);
INI_WriteInt(file,"TP",0);
INI_WriteInt(file,"FBI",0);
INI_WriteInt(file,"TERRORIST",0);
INI_Close(file);
}
}
if(dialogid==DIALOG_LOGIN)
{
if (!response) return Kick(playerid);
if(response)
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
new hashpass2[129];
WP_Hash(hashpass2,sizeof(hashpass2),inputtext);
if(!strcmp(hashpass2 ,Player[playerid][password],false))
{
GivePlayerMoney(playerid, Player[playerid][cash]);
SetPlayerScore(playerid,Player[playerid][score]);
return 1;
}
if(strcmp(hashpass2 ,Player[playerid][password],false))
{
new str3[400];
format(str3,sizeof(str3),"{FFFFFF}This Account Name \"%s\" is registered in our server.\n\nIf You are the owner of the account then please Login\n\n{B71800}Password Incorrect",PlayerName(playerid));
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"{007BBE}Login Panel",str3,"Login","Quit");
return 1;
}
return 1;
}
}
return 1;
}