Changepassword
#1

Hello, i have this command from my old gamemode, which players can be able to change password:

pawn Код:
CMD:changepass(playerid, params[])
{
  if(PlayerInfo[playerid][pLogged] == 1)
  {
  new pass[30];
  if(sscanf(params,"s[30]", pass)) return SendClientMessage(playerid, RED,"[USAGE]: /changepass [new password]");
  new query[200];
  format(query, sizeof(query),"UPDATE `playerdata` SET `password`=SHA1('%s') WHERE `user`='%s'", pass, escpname(playerid));
  mysql_query(query);
  mysql_free_result();
  new str[120];
  format(str, sizeof(str),"Your password has been successfully changed to "cred"%s", pass);
  SendClientMessage(playerid, GREEN,str);
  }
  else
  {
  SendClientMessage(playerid, RED, "ERROR: You must login in order to change your password");
  }
  return 1;
}
Since in the new gamemode im not using SHA1 anymore but SHA256, how should i edit it to make it work with new hashing system? Thanks.
Reply
#2

Can you at least update to a newer mysql plugin?

However:
pawn Код:
UPDATE `playerdata` SET `password`=SHA2('%s',256) WHERE `user`='%s' LIMIT 1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)