For password identification -
juraska - 08.08.2011
Hi, i have problem
I input proper password, but don't identification it as good password, although hi are good password
okey i show my code
data writing
Код:
INI_WriteInt(File,"Password",udb_hash(inputtext));
data reading
Код:
INI_Int("Password",PlayerData[playerid][pPassword]);
and data identification
Код:
if(udb_hash(inputtext) == PlayerData[playerid][pPassword])
{
// login
}
else
{
// wrong
}
Re: For password identification -
AndreT - 08.08.2011
I'm not familiar with the syntax of that INI include, but you probably need to use string functions like INI_WriteString or INI_String! INT functions are for integers (numbers) as the name might suggest.
Re: For password identification -
FireCat - 08.08.2011
It's not
pawn Код:
if(udb_hash(inputtext) == PlayerData[playerid][pPassword])
It's with string compare, because they are both strings.
pawn Код:
if(strcmp(udb_hash(inputtext),PlayerData[playerid][pPassword]) == 0)
Re : For password identification -
Soumi - 08.08.2011
Writing:
Код:
INI_WriteString(File,"Password",udb_hash(inputtext));
Reading:
Код:
INI_ReadString(PlayerData[playerid][pPassword],"Password", 20);
Re: For password identification -
Vince - 08.08.2011
Might be worth noting that the udb_hash (which I do not recommende using) function creates integer output only ...
Re: For password identification -
juraska - 08.08.2011
Can you give my exsample not hash password, just input text.
Thanks
Re: For password identification -
juraska - 08.08.2011
I do now using input text no hash, but now it's same like before
data identification
if(strcmp(PlayerData[playerid][pPassword],inputtext,true))
data load
INI_String("Password",PlayerData[playerid][pPassword],24);
It's still not work, what a should to do ?
Re: For password identification -
Grim_ - 08.08.2011
strcmp function returns 0 if the strings passed to the function match. Also, you should check the case sensitivity of the password, changing the bool: ignore_case parameter to false.
pawn Код:
if( !strcmp( PlayerData[ playerid ][ pPassword ], inputtext, false ) )
{
// Load data
}
Also, I highly recommend you hash/encrypt your passwords.
Re: For password identification -
juraska - 08.08.2011
Thanks guys, spelially to Grim_
I fix it.