Can log in with any password [MySQL]
#1

Thanks for your help before, guys!

This time, this is like, I can login with any password in my file.
ex; my pass is 'adawesdawds', I can still login with 'test' or any other random password.
I would like to know how to fix it. Thank you.
pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_LOG:
        {
            if(!response) return Kick(playerid);
            new hPass[129];
            new query[100];
            WP_Hash(hPass, 129, inputtext);
            if(strcmp(hPass, pData[playerid][Password]))
            {
                mysql_format(mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `Username` = '%e' LIMIT 1", GPName(playerid));
                mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);
            }
            else
            {
                MaxLoginAmount[playerid] ++;
                ShowPlayerDialog(playerid, DIALOG_LOG, DIALOG_STYLE_PASSWORD, "Invalid Password.", "The password you have entered for this account is invalid. \nPlease enter the password below:", "Login", "Quit");
            }
            if(MaxLoginAmount[playerid] >= 3)
            {
                SendClientMessage(playerid, COLOR_RED, "SERVER: You have exceeded the max amounts of login attempts [3]. You have been kicked.");
                SetTimerEx("DelayedKick", 1000, false, "i", playerid);
            }
        }
        case DIALOG_REG:
        {
            if(!response) return Kick(playerid);
            if(strlen(inputtext) < 6) return ShowPlayerDialog(playerid, DIALOG_REG, DIALOG_STYLE_PASSWORD, "Invalid Password", "The password you have entered is too small. \nPlease enter a password longer than 6 letters!", "Register", "Quit");
            new query[300];
            WP_Hash(pData[playerid][Password], 129, inputtext);
            mysql_format(mysql, query, sizeof(query), "INSERT INTO `players` (`Username`, `Password`, `IP`, `Money`, `Admin`, `pX`, `pY`, `pZ`) VALUES ('%e', '%s', '%s', 0, 0, 0.0, 0.0, 0.0)", GPName(playerid), pData[playerid][Password], IP[playerid]);
            mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid);
        }
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)