case DIALOG_REGISTER: { new INI:File = INI_Open(UserPath(playerid)); if(!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) { SendClientMessage(playerid,COLOR_GREY,#Invalid registeration password.); ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"User account registration","Type in a password combination in order \nto registrate your new account.","Register","Leave"); } INI_SetTag(File,"DATA"); INI_WriteString(File,"Password",inputtext); INI_WriteInt(File,"Cash",0); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Admin",0); INI_WriteInt(File,"Skin",0); INI_WriteInt(File,"SkinChanges",0); INI_WriteInt(File,"Spawned",0); INI_WriteInt(File,"Level",0); INI_WriteInt(File,"Donator",0); INI_WriteInt(File,"FightStyle",0); INI_WriteInt(File,"Deaths",0); INI_WriteInt(File,"Warnings",0); INI_WriteInt(File,"Kicks",0); INI_Close(File); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"User account log-in","Type in your password combination in order \nto log-in to your account","Login","Leave"); } } case DIALOG_LOGIN: { if(!response) return Kick (playerid); if(response) { if(!strlen(inputtext)) { SendClientMessage(playerid,COLOR_GREY,#Invalid password combination); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"User account log-in","Type in your password combination in order \nto log-in to your account","Login","Leave"); return 1; } if(strcmp(inputtext,PlayerInfo[playerid][pPass],true)) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); SetPlayerScore(playerid,PlayerInfo[playerid][pKills]); ResetPlayerMoney(playerid); GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]); SetPlayerInterior(playerid,5); SendClientMessage(playerid,COLOR_WHITE,"You have been successfully logged in to your user account."); TogglePlayerSpectating(playerid,false); SpawnPlayer(playerid); } else { SendClientMessage(playerid,COLOR_GREY,#Invalid password combination); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"User account log-in","Type in your password combination in order \nto log-in to your account","Login","Leave"); return 1; } } }
And so I shouldn't. It's an invasion of his user's privacy and he has no right to do so. If I'm going to help someone, it might as well be in the right way... and the right way is to tell him to hash his passwords.
|
case DIALOG_REGISTER:
{
new INI:File = INI_Open(UserPath(playerid));
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid,COLOR_GREY,#Invalid registeration password.);
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"User account registration","Type in a password combination in order \nto registrate your new account.","Register","Leave");
}
INI_SetTag(File,"DATA");
INI_WriteString(File,"Password",inputtext);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Skin",0);
INI_WriteInt(File,"SkinChanges",0);
INI_WriteInt(File,"Spawned",0);
INI_WriteInt(File,"Level",0);
INI_WriteInt(File,"Donator",0);
INI_WriteInt(File,"FightStyle",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Warnings",0);
INI_WriteInt(File,"Kicks",0);
INI_Close(File);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"User account log-in","Type in your password combination in order \nto log-in to your account","Login","Leave");
}
}
case DIALOG_LOGIN:
{
if(!response) return Kick (playerid);
if(response)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid,COLOR_GREY,#Invalid password combination);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"User account log-in","Type in your password combination in order \nto log-in to your account","Login","Leave");
return 1;
}
if(strcmp(inputtext,PlayerInfo[playerid][pPass],true))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
SetPlayerScore(playerid,PlayerInfo[playerid][pKills]);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
SetPlayerInterior(playerid,5);
SendClientMessage(playerid,COLOR_WHITE,"You have been successfully logged in to your user account.");
TogglePlayerSpectating(playerid,false);
SpawnPlayer(playerid);
}
else if(strcmp(inputtext,PlayerInfo[playerid][pPass],false))
{
SendClientMessage(playerid,COLOR_GREY,#Invalid password combination);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"User account log-in","Type in your password combination in order \nto log-in to your account","Login","Leave");
return 1;
}
}
}
If you was mature enough, you would've simply suggested that instead of using non-hashed passwords, I use hashed versions. |
case DIALOG_REGISTER:
{
if(!response) return Kick(playerid);
if(!strlen(inputtext))
{
SendClientMessage(playerid,COLOR_GREY,#Invalid registeration password.);
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"User account registration","Type in a password combination in order \nto registrate your new account.","Register","Leave");
return 1;
}
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"DATA");
INI_WriteString(File,"Password",inputtext);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Skin",0);
INI_WriteInt(File,"SkinChanges",0);
INI_WriteInt(File,"Spawned",0);
INI_WriteInt(File,"Level",0);
INI_WriteInt(File,"Donator",0);
INI_WriteInt(File,"FightStyle",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Warnings",0);
INI_WriteInt(File,"Kicks",0);
INI_Close(File);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"User account log-in","Type in your password combination in order \nto log-in to your account","Login","Leave");
return 1;
}
case DIALOG_LOGIN:
{
if(!response) return Kick(playerid);
if(!strlen(inputtext) || strcmp(inputtext,PlayerInfo[playerid][pPass],false))
{
SendClientMessage(playerid,COLOR_GREY,#Invalid password combination);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"User account log-in","Type in your password combination in order \nto log-in to your account","Login","Leave");
return 1;
}
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
SetPlayerScore(playerid,PlayerInfo[playerid][pKills]);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
SetPlayerInterior(playerid,5);
SendClientMessage(playerid,COLOR_WHITE,"You have been successfully logged in to your user account.");
TogglePlayerSpectating(playerid,false);
SpawnPlayer(playerid);
return 1;
}