03.11.2014, 19:47
I've tried a few different methods, but still failing. This is where I am currently;
So the server doesn't crash, but password and salt won't change. This is what happens;
I've tried some other formats in mysql_function_query but always error.
pawn Код:
CMD:changepass(playerid, params[])
{
if (gPlayerInfo[playerid][pLogged] == 0)
return SendClientMessage( playerid, -1, "You need to be logged in to use this. " );
new inputtext[128];
if(sscanf(params, "s[128]", inputtext))
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 hash[129], Salt[30];
randomString(Salt, SALT_LENGTH);
format(hash, sizeof(hash), "%s%s", Salt, escape(inputtext));
WP_Hash(hash, sizeof(hash), hash);
ChangePass(playerid, hash, Salt);
SendClientMessage(playerid, -1, "You have successfully changed your password.");
return 1;
}
stock ChangePass(playerid, pass[129], salt[])
{
new query[240];
format(query, sizeof (query), "UPDATE `users` SET `pass` = '%s', `salt` = '%s' WHERE `id` = '%i'", pass, salt, gPlayerInfo[playerid][pID]);
mysql_function_query(gHandle, query, false, "", "ssi");
return 1;
}
Quote:
[22:32:16] [DEBUG] mysql_escape_string - source: "perkele", connection: 1, max_len: 512 [22:32:16] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `users` SET `pass` = 'AA5D3A8A33863DA55B957DD04370248BBE1", callback: "(null)", format: "ssi" [22:32:16] [ERROR] mysql_tquery - callback parameter count does not match format specifier length |