MySQL Issues
#8

Okay.. For some reason it will only recoignise the first made accounts password. After that when more rows are added to the databases no ones registered Passwords work?
pawn Код:
case DIALOG_LOGIN:
        {
            if (!response) return Kick (playerid);
            if(response)
            {
                new buf[129];
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login:","{FFFFFF}Please Enter your password below to login. \n\nCannot be blank!","Login","Exit");
                WP_Hash(buf, sizeof(buf), inputtext);
                if(strcmp(buf, PlayerInfo[playerid][pPass]))
                {
                    if(LogginAttempts[playerid] == 2)
                    {
                        LogginAttempts[playerid] = 0;
                        Kick(playerid);
                    }
                    else
                    {
                        LogginAttempts[playerid]++;
                        new str[1024], string[256];
                        format(string, sizeof(string), "{FF4000}Incorrect Password   Attempts: %d\n", LogginAttempts[playerid]);
                        strcat(str, string);
                        format(string, sizeof(string), "{FFFFFF}You will be kicked after 3 attempts.\n");
                        strcat(str, string);
                        format(string, sizeof(string), "{FFFFFF}Please type your password below to login.\n");
                        strcat(str, string);
                        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login:", str, "Login", "Exit");
                    }
                }
                else
                {
                    LoadAccount(playerid);
                }
            }
        }
pawn Код:
stock CheckAccount(playerid)
{
    new query[82];
    format(query, sizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%s'", PlayerInfo[playerid][Name]);
    mysql_function_query(handle, query, true, "OnAccountCheck", "d", playerid);
    return 1;
}

forward OnAccountCheck(playerid);
public OnAccountCheck(playerid)
{
    if(playerid != INVALID_PLAYER_ID)
    {
        new rows, fields;
        cache_get_data(rows, fields, handle);
        if(rows)
        {
            //cache_get_row(0,1,PlayerInfo[playerid][pPass],handle, 64);
            cache_get_field_content(0, "Pass", PlayerInfo[playerid][pPass], handle, 129);
            ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login:","Please Enter your password below to login.","Login","Exit");
        }
        else
        {
            ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register:","Please Enter a password below to register.","Register","Exit");
        }
    }
    return 1;
}
Reply


Messages In This Thread
MySQL Issues - by Jacksta21 - 22.05.2014, 15:27
Re: MySQL Issues - by Konstantinos - 22.05.2014, 15:29
Re: MySQL Issues - by RajatPawar - 22.05.2014, 15:32
Re: MySQL Issues - by Jacksta21 - 22.05.2014, 15:35
Re: MySQL Issues - by RajatPawar - 22.05.2014, 15:41
Re: MySQL Issues - by Jacksta21 - 22.05.2014, 15:44
Re: MySQL Issues - by RajatPawar - 22.05.2014, 15:49
Re: MySQL Issues - by Jacksta21 - 22.05.2014, 18:23
Re: MySQL Issues - by Vince - 22.05.2014, 20:02
Re: MySQL Issues - by AiRaLoKa - 23.05.2014, 01:27

Forum Jump:


Users browsing this thread: 1 Guest(s)