07.07.2009, 23:11
Hello.
I've got a little problem with password encryption.
I'm using ****** 'Encrypt' to encrypt passwords which are saved in ini. I have already added encrypt thing for registering account and changing password, but I can't find where to add that for login.
Login looks like this:
So where do I need to add 'Encrypt(string[])' in this case?
Thanks for help
I've got a little problem with password encryption.
I'm using ****** 'Encrypt' to encrypt passwords which are saved in ini. I have already added encrypt thing for registering account and changing password, but I can't find where to add that for login.
Login looks like this:
pawn Код:
public OnPlayerLogin(playerid,password[])
{
new string2[128];
format(string2, sizeof(string2), "main/Accounts/%s.ini", PlayerName(playerid));
new File: UserFile = fopen(string2, io_read);
if ( UserFile )
{
new PassData[256];
new keytmp[256], valtmp[256];
fread( UserFile , PassData , sizeof( PassData ) );
keytmp = ini_GetKey( PassData );
if( strcmp( keytmp , "Key" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
{
new key[ 256 ] , val[ 256 ];
new Data[ 256 ];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
//other stuff
}
fclose(UserFile);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Incorrect password!");
fclose(UserFile);
return 1;
}
return 1;
}
Thanks for help