SA-MP Forums Archive
How to check if inputtext == Password ? .. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to check if inputtext == Password ? .. (/showthread.php?tid=515155)



How to check if inputtext == Password ? .. - Metharon - 24.05.2014

Good night , how can i check if inputtext = the password of account ? what i do :

pawn Код:
INI_ParseFile(UserPath(playerid), "Load_%s", .bExtra = true, .extra = playerid);               
            new pass[24];
            pass = PlayerInfo[playerid][Parola];
            if(!strcmp(pass,inputtext, false)) ( if is correct) { blabla working ok }
The problem there is : if my password is APPLE and i type BLABLA is logged me ! i don't want that !
pawn Код:
if(dialogid == LOGIN_DIALOG)
    {          
        if ( !response ) return Kick ( playerid );
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, " ", "{99CCFF}Bine ai revenit pe server , te rugam sa introduci parola in chenar pentru logare!", "Login", "Cancel");
        if( response )
        {  
            INI_ParseFile(UserPath(playerid), "Incarcare_%s", .bExtra = true, .extra = playerid);              
            new pass[24];
            pass = PlayerInfo[playerid][Parola];
            if(!strcmp(pass,inputtext, false))
            {
                INI_ParseFile(UserPath(playerid), "Incarcare_%s", .bExtra = true, .extra = playerid);      
                if(PlayerInfo[playerid][pStagiuTut] == 0)
                {
                    ClearChat(playerid);
                    InterpolateCameraPos(playerid, 1383.6500, -1578.4200, 30.8600, 860.1893, -1584.8966, 29.7883, 10000, CAMERA_MOVE);
                    ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, "  ", "{FFFFFF}- Jucator , ce sex are personajul ?\n\n{FFF1AF}[Va rugam sa raspundeti cu mare grija la intrebarile despre personajul dvs.]", "Barbat", "Femeie");
                    return 1;
                }
                else
                {
                    if(PlayerInfo[playerid][pSpawnChoose] == 1)
                    {
                        new rand = random(sizeof(SpawnPointuri));
                        SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin],SpawnPointuri[rand][0], SpawnPointuri[rand][1],SpawnPointuri[rand][2],SpawnPointuri[rand][3], 0, 0, 0, 0, 0, 0);
                    }
                    if(PlayerInfo[playerid][pSpawnChoose] == 2)
                    {
                        SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin],PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ],PlayerInfo[playerid][pAngle], 0, 0, 0, 0, 0, 0);
                    }

            }          

            return 1;
        }
    }
Where's the fault ? i want to check the string if is the password ... ( i followed this tutorial https://sampforum.blast.hk/showthread.php?tid=273088 but i removed udb function )


Re : How to check if inputtext == Password ? .. - S4t3K - 24.05.2014

Don't you hash user passwords ?


Re: How to check if inputtext == Password ? .. - eXeDev - 24.05.2014

Код:
if(response)
{
    if(inputtext == PlayerInfo[playerid][pPassword])
    {
         // If you're using a hash (which you should be), it'll be 'if(Hash(inputtext) == PlayerInfo[playerid][pPassword])'
    }
    else
    {
        SendClientMessage(playerid, COLOUR, "Wrong password!");
    }
}



Re: How to check if inputtext == Password ? .. - SickAttack - 24.05.2014

First of all, don't ever i mean EVER do that. Why aren't you hashing the password? How would you feel if the server owner of your favorite server knows your password? and even worse you use that password on your *******, ********, or even Bank Account.


Re: How to check if inputtext == Password ? .. - eXeDev - 24.05.2014

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
First of all, don't ever i mean EVER do that. Why aren't you hashing the password? How would you fell if the server owner of your favorite server knows your password? and even worse you use that password on your *******, ********, or even Bank Account.
This.

You should always hash the passwords that you store. Think about it, you're storing other people's passwords. That's a pretty big deal.

Watch this video, it's very informational. - http://*********/8ZtInClXe1Q


Re: How to check if inputtext == Password ? .. - YoungKris - 24.05.2014

never hash passwords
what they don't know won't hurt


Re: How to check if inputtext == Password ? .. - eXeDev - 24.05.2014

Quote:
Originally Posted by YoungKris
Посмотреть сообщение
never hash passwords
what they don't know won't hurt
This is a terrible idea. You should always, always, always hash your passwords! There are numerous posts, and topics about this subject. Hashing passwords is a very important. Again, please watch this video as it is extremely informational - http://*********/8ZtInClXe1Q

Also, I suggest looking into the Whirlpool plugin by ******. - showthread.php?t=65290