SA-MP Forums Archive
Change password(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: Change password(MySQL) (/showthread.php?tid=610724)



Change password(MySQL) - Problems - 27.06.2016

I use this code to change my password but It just removes my already hashed password in database

Код:
WP_Hash(Player[playerid][Password], 129, inputtext);
mysql_format(koneksi, query, sizeof(query), "UPDATE `users` SET `Password` = '%e' WHERE `Name` = '%e'",Player[playerid][Password], PlayerName(playerid));
mysql_query(koneksi, query);



Re: Change password(MySQL) - justjamie - 27.06.2016

PHP код:
WP_Hash(Player[playerid][Password], 129inputtext);
mysql_format(koneksiquerysizeof(query), "UPDATE `users` SET `Password` = '%s' WHERE `Name` = '%e'",inputtextPlayerName(playerid));
mysql_query(koneksiquery); 



Re: Change password(MySQL) - Sjn - 27.06.2016

Quote:
Originally Posted by justjamie
Посмотреть сообщение
PHP код:
WP_Hash(Player[playerid][Password], 129inputtext);
mysql_format(koneksiquerysizeof(query), "UPDATE `users` SET `Password` = '%s' WHERE `Name` = '%e'",inputtextPlayerName(playerid));
mysql_query(koneksiquery); 
Why are you replacing %e with %s? %e is needed to escape the string. Also, the hashed password is stored in the Player[playerid][Password], using inputtext isn't needed either.


Re: Change password(MySQL) - Problems - 27.06.2016

So how to solve it


Re: Change password(MySQL) - Problems - 27.06.2016

Sorry for bumping but I really need any clue about it


Re: Change password(MySQL) - Logic_ - 27.06.2016

Show us some more part of the code.


Re: Change password(MySQL) - DRIFT_HUNTER - 27.06.2016

Just replace inputtext in mysql format with Player[playerid][Password]
Also you dont need to escape password since its hashed with Whirpool, but you can its not gonna break anything.


Re: Change password(MySQL) - Problems - 27.06.2016

Sorry,Didn't update the post
Already fixed.