15.06.2018, 14:23
https://sampwiki.blast.hk/wiki/SHA256_PassHash
Third parameter is the returned hash, first parameter is const so don't assign the third parameter to the 1st parameter.
pass has the normal password.
pInfo[playerid][Password] has the hashed password.
Third parameter is the returned hash, first parameter is const so don't assign the third parameter to the 1st parameter.
PHP код:
CMD:changepass(playerid,params[])
{
new Query[100], pass[200];
if(sscanf(params, "s[200]", pass)) return Usage(playerid, "/changepass [password]");
if(strlen(pass) < 3 || strlen(pass) > 12) return Error(playerid, "Incorrect Password length");
SHA256_PassHash(pass, pInfo[playerid][Salt], pInfo[playerid][Password], 65);
//pInfo[playerid][Password] = pass;
mysql_format(Database, Query, sizeof(Query), "UPDATE `users` SET `Password` = '%e' WHERE `pID` =%d LIMIT 1", pInfo[playerid][Password], pInfo[playerid][pID]);
mysql_tquery(Database, Query,"","");
format2(playerid, COLOR_LIGHTGREEN, "Your password has been successfully changed to (%s)", str);
return 1;
}
pInfo[playerid][Password] has the hashed password.