Got a problem with hashing?
#1

Hey everyone, it's me again.


A guy just helped me with making a whole new register system, but when he made the hashing thing everything got basically screwd up in some way.

The problem is that I have two accounts, right. When I am making a new account it changes the password on every fucking users that's registered. I can't get what's wrong and it's kinda strange. It might be something wrong with the hashing? I got the Whirlpool plugin and everything, so it can't be anything wrong with it.

Here is the script part with the hashing etc:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if( response )
            {
                if( isnull( inputtext ) )
                {
                    // There's an exploit if you just hit enter and leave the field blank, it'll automatically log you in with a blank password.
                    // This prevents it.
                    ShowRegisterDialog;
                }

                format( PlayerPassword [playerid], 129, inputtext );
                ShowGenderDialog;
            }
            else
            {
                // They hit quit, let's kick them.
                Kick(playerid);
            }
        }

        case DIALOG_LOGIN:
        {
            if( response )
            {
                if( isnull (inputtext) )
                {
                    ShowLoginDialog;
                    return 0;
                }

                new
                    hashPass [129];

                WP_Hash(hashPass, sizeof hashPass, inputtext);
                if (strcmp(hashPass,PlayerInfo[playerid][Password],true) == 0 )
                {
                    INI_ParseFile( GetPlayerPath(playerid), "LoadAccount_%s", .bExtra = true, .extra = playerid );
                    PlayerLogged [playerid] = true;

                    SetPlayerScore( playerid, PlayerInfo [playerid] [Level] );
                    GivePlayerMoney( playerid, PlayerInfo [playerid] [Cash] );


                    SetSpawnInfo(playerid, NO_TEAM, PlayerInfo[playerid][Model], 1686.1014, -2332.1179, -2.6797, 355.4632, 0, 0, 0, 0, 0, 0);
                    SpawnPlayer(playerid);
                }
                else return ShowLoginDialog;
            }
            else
            {
                Kick(playerid);
            }
        }
Anyone who knows what's wrong?
Reply
#2

For reg/login system, I suggest you to watch this tutorial https://sampforum.blast.hk/showthread.php?tid=352703
I used it, edited a little bit, and it works great.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)