31.05.2017, 22:36
If player forgot his password and i wanted to reset it for him and system saves password in hash [Whirlpool] how can i convert it to a normal password to help the player??
You shouldn't... If they need password reset, reset it.
Recovering passwords is a very bad move as many people use the same password elsewhere, and if you are fooled by a player giving someones password out, then you're compromising your players security which contravenes the SA-MP license agreement. |
CMD:setpassword(playerid, params[])
{
if(pData[playerid][Admin] >= 7)
{
new query[320], name[24], newpass[34], hash1[34];
if(sscanf(params, "s[24]s[34]", name, newpass)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /setpassword <PlayerName> <NewPassword>");
if(!AccountExists(name)) return SendClientMessage(playerid, red, "Account does not exists");
WP_Hash(hash1, 129, newpass);
mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `Password` = '%e' WHERE `Username` = '%e'", hash1, name);
mysql_tquery(mysql, query);
format(query, sizeof(query), "You have changed %s's password to %s", name, newpass);
SendClientMessage(playerid, COLOR_GREEN, query);
new IRC[130];
format(IRC, sizeof(IRC), "1,8* Admin %s (ID: %d) changed %s's password to %s .",GetName(playerid), playerid, name, newpass);
IRC_GroupSay(groupID, "&#ZoneX", IRC);
IRC_GroupSay(groupID, IRC_aCHANNEL, IRC);
return 1;
}
else return ShowMessage(playerid, COLOR_YELLOW, 1, 7);
}
I have a command to set the password of an offline player that help me in that but its not working it doesn't set the player password correctly
PHP код:
|
CMD:setpassword(playerid, params[])
{
if(pData[playerid][Admin] >= 7)
{
new query[320], name[24], newpass[34], hash1[34];
if(sscanf(params, "s[24]s[34]", name, newpass)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /setpassword <PlayerName> <NewPassword>");
if(!AccountExists(name)) return SendClientMessage(playerid, red, "Account does not exists");
mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `Password` =WP_Hash('%s') WHERE `Username` = '%s'", newpass, name);
mysql_tquery(mysql, query);
format(query, sizeof(query), "You have changed %s's password to %s", name, newpass);
SendClientMessage(playerid, COLOR_GREEN, query);
new IRC[130];
format(IRC, sizeof(IRC), "1,8* Admin %s (ID: %d) changed %s's password to %s .",GetName(playerid), playerid, name, newpass);
IRC_GroupSay(groupID, "&#ZoneX", IRC);
IRC_GroupSay(groupID, IRC_aCHANNEL, IRC);
return 1;
}
else return ShowMessage(playerid, COLOR_YELLOW, 1, 7);
}