Whirlpool -
Antoniohl - 07.05.2015
There's something wrong with whirlpool, i can connect with any account with any password
Here's my codes it's under OnPlayerConnect
Code:
if(fexist(UserPath(playerid))) ShowLoginDialog(playerid, D_LOGIN);
else ShowRegisterDialog(playerid, D_REGISTER);
and here's Dialog Register
Code:
case D_REGISTER:
{
if(response)
{
if(strlen(inputtext) > 18)
{
SendInfoMessage(playerid, 0, "8", "Password must be a maximum of 18 characters.");
ShowRegisterDialog(playerid,D_REGISTER);
return 1;
}
if(IsNull(inputtext))
{
ShowRegisterDialog(playerid,D_LOGIN);
return 1;
}
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
new INI:file = INI_Open(UserPath(playerid));
INI_WriteString(file,"Password",hashpass);
INI_Close(file);
Dialog(playerid,D_LOGIN,DIALOG_STYLE_PASSWORD,"{00FF6E}Log in","{F0F0F0}For security reasons, confirm your password:","Confirm","Cancel");
}
else
{
Kick(playerid);
}
return 1;
}
Okay now stop here i should type the correct password to login right?.. it doesn't work sometimes it says wrong password and it's the correct one and sometimes i'll be able to login with any password
and here's login dialog
Code:
case D_LOGIN:
{
if (response)
{
if(IsNull(inputtext))
{
ShowLoginDialog(playerid,D_LOGIN);
return 1;
}
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(hashpass, PlayerInfo[playerid][pPassword], false))
{
new string2[128], playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), "Accounts/%s.ini", playername2);
INI_ParseFile(string2, "LoadUserInformation", false, true, playerid, true, false );
format(string2, sizeof(string2), "PlayersVehicles/%s.ini", playername2);
INI_ParseFile(string2, "LoadUserVehicleInformation", false, true, playerid, true, false );
format(string2, sizeof(string2), "PlayersToys/%s.ini", playername2);
INI_ParseFile(string2, "LoadUserToysInformation", false, true, playerid, true, false );
PlayerConnected(playerid);
}
else
{
ClearChatbox(playerid);
ShowLoginDialog(playerid,D_LOGIN);
SendInfoMessage(playerid, 0, "7", "The typed password is not valid, please try again.");
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 3) { Kick(playerid); }
}
}
else
{
Kick(playerid);
}
return 1;
}
AW: Whirlpool -
Mencent - 07.05.2015
Hello!
After register you have to put in your password in the array: PlayerInfo[playerid][pPassword]
Please change the length of pPassword in the format in the following code:
PHP Code:
case D_REGISTER:
{
if(response)
{
if(strlen(inputtext) > 18)
{
SendInfoMessage(playerid, 0, "8", "Password must be a maximum of 18 characters.");
ShowRegisterDialog(playerid,D_REGISTER);
return 1;
}
if(IsNull(inputtext))
{
ShowRegisterDialog(playerid,D_LOGIN);
return 1;
}
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
new INI:file = INI_Open(UserPath(playerid));
INI_WriteString(file,"Password",hashpass);
INI_Close(file);
format(PlayerInfo[playerid][pPassword],129,hashpass);
Dialog(playerid,D_LOGIN,DIALOG_STYLE_PASSWORD,"{00FF6E}Log in","{F0F0F0}For security reasons, confirm your password:","Confirm","Cancel");
}
else
{
Kick(playerid);
}
return 1;
}
So. Does it work now? If not, please explain me what is wrong.
Re: Whirlpool -
Antoniohl - 07.05.2015
lol i've made it before i look here anyway thanks mencent!