16.07.2013, 14:51
Okay for some reason my login system is accepting any password, I've been looking around for about 2 days. I can not figure this one out. So here is my code:
I don't get any errors at all. So if someone could help me it would be greatly appreciated!
pawn Код:
if(dialogid == DIALOG_REGISTER)
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Registering...","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
INI_SetTag(File,"data");
INI_WriteString(File, "Password", hashpass);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"Banned",0);
INI_WriteInt(File,"Muted",0);
INI_WriteInt(File,"Regular",0);
INI_Close(File);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Success!","Great! You have succesfully created your account!","Ok","");
}
}
if(dialogid == DIALOG_LOGIN)
{
if (!response) return Kick(playerid);
if(response)
{
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext); //Will hash inputted password
if(!strcmp(hashpass,SInfo[playerid][pPass]))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, SInfo[playerid][pCash]);
SetPlayerScore(playerid, SInfo[playerid][pScore]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"Success!","You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","You have entered an incorrect password.\nPlease retype your password below to login.","Login","Quit");
}
return 1;
}
}
return 0;
}