MySQL Changing 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: MySQL Changing Password (
/showthread.php?tid=616919)
MySQL Changing Password -
Ahmed21 - 12.09.2016
Hello, I've made a dialog to change the account's password, I type /changepw, then a dialog shows up, I write the password and it says in chat "changed pw to..", but it's not changed on the database. I've tried to fix it many times, but no chance :C help please.
PHP код:
case DIALOG_CHANGEPW:
{
if(response)
{
if(pInfo[playerid][LoggedIn] == 1)
{
if(isnull(inputtext)) return ShowPlayerDialog(playerid, DIALOG_CHANGEPW, DIALOG_STYLE_INPUT, ""COL_WHITE"Changing Password", ""COL_WHITE"Write the new password. Do not forget it!\n\n"COL_RED"Your password must be at least 5 characters!", "Done", "Close");
if(strlen(inputtext) < 5) return ShowPlayerDialog(playerid, DIALOG_CHANGEPW, DIALOG_STYLE_INPUT, ""COL_WHITE"Changing Password", ""COL_WHITE"Write the new password. Do not forget it!\n\n"COL_RED"Your password must be at least 5 characters!", "Done", "Close");
new string[128], hash[129], query[200];
WP_Hash(hash, sizeof(hash), inputtext);
mysql_format(mysql, query, sizeof(query), "UPDATE `users` SET `Password` = %e WHERE `ID` = %d", hash, pInfo[playerid][ID]);
mysql_tquery(mysql, query, "");
format(string, sizeof(string), "You have successfully changed your password to %s. Don't forget it!", inputtext);
NGMSG(playerid, string);
}
}
}
Re: MySQL Changing Password -
Stinged - 12.09.2016
Use '' around strings.
`Password` = '%e' instead of
`Password = %e
Re: MySQL Changing Password -
Stuntff - 12.09.2016
Код:
mysql_format(mysql, query, sizeof(query), "UPDATE `users` SET Password = '%e' WHERE ID = '%d'", hash, pInfo[playerid][ID]);
mysql_tquery(mysql, query, "", "");