SA-MP Forums Archive
MD5 and Mysql - 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: MD5 and Mysql (/showthread.php?tid=326772)



MD5 and Mysql - StuffBoy - 18.03.2012

I got a problem with md5, I encrypted a password in a dialog and at phpmyadmin the password is encrypted , but i can't login, I try ed to encript the password when the player logs and query it but doesn't work, hope someone uses this include and can give me some help thanks.
The code:
pawn Код:
new query[100]; // Register Part
MD5_Hash(inputtext);
format(query, sizeof(query),"INSERT INTO playerdb (id,username,password,score) VALUES (NULL,'%s',md5('%s'),%d)",playerdb[playerid][username],inputtext,1);
mysql_query(query);

new query[150]; // login part
MD5_Hash(inputtext);
format(query, sizeof(query),"SELECT * FROM playerdb WHERE username = '%s' AND password = md5('%s')",playerdb[playerid][username],inputtext);
mysql_query(query);
Here is the include attachment.


Re: MD5 and Mysql - iJumbo - 18.03.2012

You dont have to use MD5_Hash .. try use only the md5('') on the query


Re: MD5 and Mysql - StuffBoy - 18.03.2012

Quote:
Originally Posted by [ISS]jumbo
Посмотреть сообщение
You dont have to use MD5_Hash .. try use only the md5('') on the query
You was right i don't require to use the MD5 include, Mysql supports MD5 automatically but the problem was that i
was using varchar 50 for the password and i changed it to char 32 because MD5 is based 32 cells encriptation. Thank you anyway and reputation for you.