03.03.2012, 02:52
Hello guys,
I've used this tutorial : https://sampforum.blast.hk/showthread.php?tid=273088
To make myself a login/register system using y_ini. Everything work's fine. But the biggest problem is no matter password you enter. You still can access anyone's account? Ex: I entered pass as 12345 on Registration. But i can login with any number? Idk why. Im using udb_hash to hash password's?
Is there anyone who can correct my code's? or can Save the string as it is entered into the ini file for the user. And correct the Login Dialog response for me! I hope you understand!
- BMiaa
-Posted my code below-
I've used this tutorial : https://sampforum.blast.hk/showthread.php?tid=273088
To make myself a login/register system using y_ini. Everything work's fine. But the biggest problem is no matter password you enter. You still can access anyone's account? Ex: I entered pass as 12345 on Registration. But i can login with any number? Idk why. Im using udb_hash to hash password's?
Is there anyone who can correct my code's? or can Save the string as it is entered into the ini file for the user. And correct the Login Dialog response for me! I hope you understand!
- BMiaa
-Posted my code below-
pawn Код:
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
{
new regstring[128];
format(regstring,sizeof(regstring),"Country Wars:WWIII\nPlease register your account by typing you password below");
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Register",regstring,"Register","Exit");
SendClientMessage(playerid, COLOR_YELLOW, "Your password can not be left blank. Please input password to register your account & proceed.");
}
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Key",udb_hash(inputtext));
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Banned",0);
INI_WriteInt(File,"DonateRank",0);
INI_WriteInt(File,"Warnings",0);
INI_WriteInt(File,"Jail",0);
INI_WriteInt(File,"JailTime",0);
INI_WriteInt(File,"Cash", 0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Muted",0);
INI_WriteInt(File,"Hide",0);
INI_WriteInt(File,"Spree",0);
INI_WriteInt(File,"DuelWon",0);
INI_WriteInt(File,"DuelLost",0);
INI_WriteInt(File,"Clan",0);
INI_WriteInt(File,"ClanRank",0);
INI_Close(File);
}
}
case DIALOG_CHANGEPASS:
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Key",udb_hash(inputtext));
INI_Close(File);
new str[128];
format(str, sizeof(str), "[CW:WW3] Your password has been changed to %s",inputtext);
SendClientMessage(playerid, COLOR_RED, str);
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pKey])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
//JustLogin[playerid] = 1;
}
else
{
new loginstring[256];
SendClientMessage(playerid, COLOR_YELLOW, "[CW:WW3] That name is registered, please wait to login");
SendClientMessage(playerid, COLOR_WHITE, "HINT: You can now login by typing your password below");
format(loginstring,sizeof(loginstring),"Country Wars:WWIII\nThat name is registered. please enter your password below");
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login",loginstring,"Login","Exit");
}
return 1;
}
}