[MySQL]Hash
#1

How to hash passwords ?
Here is the code...
pawn Код:
public OnPlayerLogin(playerid,password[])
{
    SendClientMessage(playerid, COLOR_WHITE, "Logging you in.");
    new string2[128], string[1024], pName[MAX_PLAYER_NAME], Escape[2][128], result[128];//keystring[256],
    pName = PlayerName(playerid);
    mysql_real_escape_string(pName, Escape[0]);
    WP_Hash(hashPassword, 129, password);
    SaveToMysql(password);
    mysql_real_escape_string(password, Escape[1]);
    format(string, sizeof(string), "SELECT * FROM players WHERE `Name`='%s' AND `Key`='%s'",Escape[0],Escape[1]);
    mysql_query_ex(string);
    mysql_store_result();
    SendClientMessage(playerid, COLOR_WHITE, "Checking your password...");
    if(mysql_num_rows() == 0)
    {
        mysql_free_result();
        SendClientMessage(playerid, COLOR_RED, "Your password is wrong!");
        ShowPlayerDialog(playerid, LOGIN_DIALOG, 1, "{3399CC}Information", "{FFFFFF}You have an account here, please type below your password to login.", "Login", "Quit");
        WrongPass[playerid]++;
        if(WrongPass[playerid]>6)
        {
            Kick(playerid);
        }
        return 1;
    }
    mysql_retrieve_row();
Reply


Messages In This Thread
[MySQL]Hash - by erorche - 30.11.2013, 11:35
Re: [MySQL]Hash - by SilentSoul - 30.11.2013, 11:36
Re: [MySQL]Hash - by erorche - 30.11.2013, 11:39
Re: [MySQL]Hash - by Konstantinos - 30.11.2013, 11:44
Re: [MySQL]Hash - by erorche - 30.11.2013, 11:50
Re: [MySQL]Hash - by xVIP3Rx - 30.11.2013, 11:50
Re: [MySQL]Hash - by erorche - 30.11.2013, 12:18

Forum Jump:


Users browsing this thread: 3 Guest(s)