edit .ini ( account) password dont work.
#1

Hello,

My register and login script works perfectly, but when I edit a account My_Account.ini with Notepad or Wordpad there are 2 different versions but the password is always bugged.

If I edit with Notepad for example the money , I open the server, the password is delete key= (nothing) if i write any password i successfully logged in

If I edit with Wordpad for example the money, I open the server, the password is correct but if I write the good password, it say bad password.


Код:
public OnPlayerLogin(playerid,password[])
{
	new tmp2[126];
    new string2[126];
	new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    GetPlayerIp(playerid, ips, sizeof(ips));
	format(string2, sizeof(string2), "%s.ini", playername2);
	new File: UserFile = fopen(string2, io_read);
	if ( UserFile )
	{
	    new PassData[256];
	    new keytmp[256], valtmp[126];
	    fread( UserFile , PassData , sizeof( PassData ) );
	    keytmp = ini_GetKey( PassData );
	    printf("keytmp %s",keytmp);
	    if( strcmp( keytmp , "Key" , true ) == 0 )
		{
		    printf("key %s",PlayerInfo[playerid][pKey]);
		    printf("password %s",password);
			valtmp = ini_GetValue( PassData );
			printf("valtmp %s",valtmp);
			strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
		}
		if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
		{
			    new key[ 256 ] , val[ 126 ];
			    new Data[ 126 ];
			    printf("password2 %s",password);
			    printf("Key2 %s",PlayerInfo[playerid][pKey]);
			    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 ); }
			    	if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
			        if( strcmp( key , "UpgradePoints" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][gPupgrade] = strval( val ); }
			        ...
			        ...
			        ...
                }
                fclose(UserFile);
		}
        else
		{
	        fclose(UserFile);
	        gPlayerLogTries[playerid] += 1;
	        ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,"Try Again, please Log-In","You have entered an incorrect password\nType your password below to log-in","Log-in","Quit");
	        if(gPlayerLogTries[playerid] == 3) { Kick(playerid); }
	        return 1;
		}
		SpawnPlayer(playerid);
	}
	return 1;
}
I add some printf() , with Notepad keytmp= яKey so bugged, key is not read correctly, with Wordpad keytmp= Key so correct but the password is always bad.


log:

//Notepad good pass "test"
[01:26:56] // password write: p
[01:26:56] keytmp яKey
[01:26:56] key p
[01:26:56] password //nothing
[01:26:56] My_Account has logged in.



//Wordpad ( good pw: test)

//test1
[02:57:12] //password write:test
[02:57:12] keytmp Key
[02:57:12] key test
[02:57:12] password test
// why space?
[02:57:12] valtmp test

//test2
[02:57:44] // password write: test
[02:57:44] keytmp Key
[02:57:44] key test
[02:57:44] password test
// why space?
[02:57:44] valtmp test
// end stop here


What's the problem? the script? Editor? ini_GetKey?

Thank you.
Reply
#2

Just use pawno to edit files
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)