Users password bug?
#1

Hi all...

Sometimes, the password of my players change with other players passwords...
The same thing with names of the three characters...
What can I do?
Here's the code I THINK is wrong.
pawn Код:
forward Cambionome(playerid);
    public Cambionome(playerid)
    {
    format(string, 128, "SELECT * FROM users WHERE username = '%s'", PlayerName3);
                mysql_query(string);
                new string22[256];
                format(string22,sizeof(string22),"INSERT INTO users (username, password,nomepersonaggio1,nomepersonaggio2,nomepersonaggio3) VALUES ('%s', '%s', '%s', '%s,'%s')",PlayerName3, PlayerInfo[playerid][pKey], PlayerInfo[playerid][pNomePersonaggio1],PlayerInfo[playerid][pNomePersonaggio2],PlayerInfo[playerid][pNomePersonaggio3]);
                mysql_query(string22);
    SetPlayerName(playerid, PlayerInfo[playerid][pNomePersonaggio1]);
    //OnPlayerLogin(playerid, PlayerInfo[playerid][pKey]);
    NameTag[playerid] = Create3DTextLabel(RPN(playerid), 0xFFFFFFFF, 0, 0, 0, NAME_DRAWDISTANCE, 0, 1 );
    Attach3DTextLabelToPlayer(NameTag[playerid], playerid, 0.0, 0.0, 0.2);
                if (PlayerInfo[playerid][pTut] == 0)
                {
                    OnPlayerRegister(playerid, PlayerInfo[playerid][pKey]);
                    ShowPlayerDialog(playerid, SEXMENU, DIALOG_STYLE_MSGBOX, "{00C0FF}Scelta sesso", "{FFFFFF}Sei un uomo o una donna?", "Uomo", "Donna");
      PlayerInfo[playerid][pPersSecondario] = 1;
      PlayerInfo[playerid][pTut] = 1;
                }
                else
                {
                    //SpawnPlayer(playerid);
                    gLoggato[playerid] = 1;
                    //OnPlayerLogin(playerid, PlayerInfo[playerid][pKey]);
                    PlayerInfo[playerid][pPersSecondario] = 1;
                    if(PlayerInfo[playerid][pTipoSpawn] == 0)
                {
                if(PlayerInfo[playerid][pCrashato] == 1)
                {
                StopAudioStreamForPlayer(playerid);
                TextDrawHideForPlayer(playerid, Textdrawlogin0);
                TextDrawHideForPlayer(playerid, Textdrawlogin1);
                TextDrawHideForPlayer(playerid, Textdrawlogin2);
                TextDrawHideForPlayer(playerid, Textdrawlogin3);
                TextDrawHideForPlayer(playerid, Textdrawlogin4);
                TextDrawHideForPlayer(playerid, Textdrawlogin5);
                TextDrawHideForPlayer(playerid, Textdrawlogin6);
                ShowPlayerDialog(playerid, DIALOG_CRASH, DIALOG_STYLE_MSGBOX, "{00D0FF}Crash", "Nella tua ultima sessione di gioco sei crashato.\nDove preferisci spawnare?","Ultima Pos.","Altro");
                }
                else
                {
                InterpolateCameraPos(playerid, -1581.887695, 327.298400, 21.836509, -1634.896606, 409.670410, 59.854118, 15000);
        InterpolateCameraLookAt(playerid, -1584.259277, 331.332061, 23.598611, -1637.349853, 413.546051, 61.844299, 15000);
        SetPlayerVirtualWorld(playerid, 1);
        SetPlayerPos(playerid, -1581.887695, 327.298400, 21.836509);
        SetTimerEx("VisualeLogin2", 15000, false, "i", playerid);
    ShowPlayerDialog(playerid, DIALOG_CRASH, DIALOG_STYLE_MSGBOX, "{00D0FF}Login", "{FFFFFF}Bentornato su One Roleplay!\n{FFFFFF}Dove preferisci spawnare?","Ultima Pos.","Predef.");
    StopAudioStreamForPlayer(playerid);
                TextDrawHideForPlayer(playerid, Textdrawlogin0);
                TextDrawHideForPlayer(playerid, Textdrawlogin1);
                TextDrawHideForPlayer(playerid, Textdrawlogin2);
                TextDrawHideForPlayer(playerid, Textdrawlogin3);
                TextDrawHideForPlayer(playerid, Textdrawlogin4);
                TextDrawHideForPlayer(playerid, Textdrawlogin5);
                TextDrawHideForPlayer(playerid, Textdrawlogin6);
                }
            }
            else if(PlayerInfo[playerid][pTipoSpawn] == 1)
            {
                if(PlayerInfo[playerid][pCrashato] == 1)
                {
                StopAudioStreamForPlayer(playerid);
                TextDrawHideForPlayer(playerid, Textdrawlogin0);
                TextDrawHideForPlayer(playerid, Textdrawlogin1);
                TextDrawHideForPlayer(playerid, Textdrawlogin2);
                TextDrawHideForPlayer(playerid, Textdrawlogin3);
                TextDrawHideForPlayer(playerid, Textdrawlogin4);
                TextDrawHideForPlayer(playerid, Textdrawlogin5);
                TextDrawHideForPlayer(playerid, Textdrawlogin6);
                ShowPlayerDialog(playerid, DIALOG_CRASH, DIALOG_STYLE_MSGBOX, "{00D0FF}Crash", "Nella tua ultima sessione di gioco sei crashato.\nVuoi tornare alla tua vecchia posizione o spawnare in un altro posto?", "Ultima Pos.", "Altro");
                }
                else
                {
                StopAudioStreamForPlayer(playerid);
                TextDrawHideForPlayer(playerid, Textdrawlogin0);
                TextDrawHideForPlayer(playerid, Textdrawlogin1);
                TextDrawHideForPlayer(playerid, Textdrawlogin2);
                TextDrawHideForPlayer(playerid, Textdrawlogin3);
                TextDrawHideForPlayer(playerid, Textdrawlogin4);
                TextDrawHideForPlayer(playerid, Textdrawlogin5);
                TextDrawHideForPlayer(playerid, Textdrawlogin6);
                InterpolateCameraPos(playerid, -1581.887695, 327.298400, 21.836509, -1634.896606, 409.670410, 59.854118, 15000);
        InterpolateCameraLookAt(playerid, -1584.259277, 331.332061, 23.598611, -1637.349853, 413.546051, 61.844299, 15000);
        SetPlayerVirtualWorld(playerid, 1);
        SetPlayerPos(playerid, -1581.887695, 327.298400, 21.836509);
        SetTimerEx("VisualeLogin2", 15000, false, "i", playerid);
                ShowPlayerDialog(playerid, DIALOG_CRASH, DIALOG_STYLE_MSGBOX, "{00D0FF}Login", "{FFFFFF}Bentornato su One Roleplay!\n{FFFFFF}Dove preferisci spawnare?","Ultima Pos.","Predef.");
    }
}
                }
                return 1;
                }
Thanks!
Reply
#2

Where are you defining "PlayerName3"?
Reply
#3

Quote:
Originally Posted by SKAzini
Посмотреть сообщение
Where are you defining "PlayerName3"?
This and make sure you only save the password ONCE and that is when the account is created, rest of the time players login they only load. You can also save them at changepw type of cmds, but never save them everytime save function is called.
Reply
#4

Quote:
Originally Posted by Blast3r
Посмотреть сообщение
This and make sure you only save the password ONCE and that is when the account is created, rest of the time players login they only load. You can also save them at changepw type of cmds, but never save them everytime save function is called.
Uhm, I have definied PlayerName3 now. I will try...

The password saves in OnPlayerRegister
pawn Код:
strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255);
Saves in OnPlayerSave
pawn Код:
format(var, 32, "Key=%s\n", PlayerInfo[playerid][pKey]);fwrite(hFile, var);
and in OnPlayerLogin.

Do you think it will work with PlayerName3? Why I didn't get errors?
Reply
#5

No, no and just no! Don't do this - at first you show us a part of your code which looks like it will load some data from a Database, and then you show us your flat-file "loading and saving" system which looks like it's straight from GF/PEN1 - using "strmid" was "high-tec" in 2007.
Please, don't just copy others code and expect it to work, instead, carefully plan your code out - write it down on a piece of paper if you must.
Reply
#6

Why aren't you hashing the passwords?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)