09.11.2014, 14:56
I still can't get forward with this matter. Always the same error:
My code looks like this now:
Help please
Код:
[17:46:44] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `users` SET `pass`='D5FBADCC1D96C6A3B676186562457AE055C03", callback: "query", format: "(null)" [17:46:44] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called [17:46:44] [DEBUG] mysql_tquery - scheduling query "UPDATE `users` SET `pass`='D5FBADCC1D96C6A3B676186562457AE055C03568CDCA527459E6C42C9A89D93E1269D2B09E9E0AE9335B7FC8F234CDBC542DDDFA936BFFD781FA53E8B7CD1A93', `salt`='2249ylqI1902MW91auv9EhT9590AF8D5FBADCC1D96C6A3B676186562457AE055C03568CDC".. [17:46:44] [DEBUG] CMySQLQuery::Execute[query()] - starting query execution [17:46:44] [ERROR] CMySQLQuery::Execute[query()] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2249ylqI1902MW91auv9EhT9590AF8D5FBADCC1D96C6A3B676186562457AE055C03568CDC' at line 1
pawn Код:
CMD:changepass(playerid, params[])
{
if (gPlayerInfo[playerid][pLogged] == 0)
return SendClientMessage( playerid, -1, "You need to be logged in to use this. " );
new newpass[129];
if(sscanf(params, "s[128]", newpass))
return SendClientMessage( playerid, -1, "USAGE: /changepass [New password]. " );
if (strlen(params) > 90)
return SendClientMessage(playerid, -1, "Password has to be between 1 and 90 characters.");
new Salt[30];
randomString(Salt, SALT_LENGTH);
WP_Hash(newpass, 129, newpass);
format(newpass, sizeof(newpass), "%s", (newpass));
new query[240];
format(query, sizeof(query), "UPDATE `users` SET `pass`='%s', `salt`='%s' WHERE `id`='%i'", newpass, Salt, gPlayerInfo[playerid][pID]);
mysql_function_query(gHandle, query, false, "query", "", "", "");
SendClientMessage(playerid, -1, "You have successfully changed your password.");
SendClientMessage(playerid, -1, "Password changed.");
return 1;
}