SA-MP Forums Archive
Mysql little problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Mysql little problem (/showthread.php?tid=275742)



Mysql little problem - Tigerkiller - 10.08.2011

hi all
i know how to md5 password but idk how to convert the current md5 in the database to the correcct passwords. any ideas?
pls help


Re: Mysql little problem - Vince - 10.08.2011

Hashes cannot be decrypted, that's the point of a hash. To check if a password is correct, you'd do this:

pawn Код:
SELECT * FROM Users WHERE Name = 'playername' AND Password = md5('inputtext')



Re: Mysql little problem - Tigerkiller - 10.08.2011

can you make a little dialog with it pls


Re: Mysql little problem - TheArcher - 10.08.2011

This is a exemple when the dialog response

pawn Код:
new
                query[256],
                playerName[MAX_PLAYER_NAME],
                escapedName[MAX_PLAYER_NAME],
                escapedPassword[129];

            GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);      
            WP_Hash(escapedPassword, sizeof(escapedPassword), inputtext);
            mysql_real_escape_string(inputtext, escapedPassword);
           
            mysql_real_escape_string(playerName, escapedName);

            format(query, sizeof(query), "SELECT * FROM `[YourAccounts]` WHERE [yourfield]= '%s' AND [passfield] = '%s'", escapedName, escapedPassword);
            mysql_query(query, [YourQuery], playerid);
NOTE: YOU HAVE TO CHANGE THE PARAMS IN [ ]