MySQL Login fail ?
#1

Hello, i have a problem. I made a Login/Register system using MySql, but the problem now is the login. When you try to login even if you put the right password it dosen't work again. here's the onplayerpasswordresponse code:

pawn Код:
forward OnPasswordResponse(playerid);
public OnPasswordResponse(playerid)
{
    new num_fields,num_rows;
    cache_get_data(num_rows,num_fields,dbhandel);
    if(num_fields==1)
    {
        iInfo[playerid][loggt] = 1;
       
        iInfo[playerid][score] = cache_get_field_content_int(0,"score",dbhandel);
    }
    else
    {
        SendClientMessage(playerid, BJELA, "Ukucana lozinka se ne poklapa sa ovim nalogom.");
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "LOGIN", "UPISITE VASU LOZINK KAKO BI PRISTUPILI SERVERU.", "LOGIN", "OTKAZI");
    }
    return 1;
}
here's the onplayerdialogresponse:
pawn Код:
if(dialogid==DIALOG_LOGIN)
    {
        if(response)
        {
            new name[MAX_PLAYER_NAME],query[128],password[255];
            GetPlayerName(playerid,name,sizeof(name));
            if(strlen(inputtext)>0)
            {
                mysql_escape_string(inputtext,password,dbhandel);
                format(query,sizeof(query),"SELECT * FROM acoounts WHERE username='%s' AND password='%s'",name,password);
                mysql_function_query(dbhandel,query,true,"OnPasswordResponse","i",playerid);
            }
            else
            {
                SendClientMessage(playerid,BJELA,"Upisite vasu lozinku!");
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "LOGIN", "UPISITE VASU LOZINK KAKO BI PRISTUPILI SERVERU.", "LOGIN", "OTKAZI");
            }
        }
        else
        {
            Kick(playerid);
        }
        return 1;
    }
Oh and my database/tables
Reply


Messages In This Thread
MySQL Login fail ? - by malackovgfx - 12.06.2015, 09:47
Re: MySQL Login fail ? - by mamorunl - 12.06.2015, 10:36
Re: MySQL Login fail ? - by malackovgfx - 12.06.2015, 10:56
Re: MySQL Login fail ? - by Konstantinos - 12.06.2015, 11:07
Re: MySQL Login fail ? - by malackovgfx - 12.06.2015, 11:10
Re: MySQL Login fail ? - by mamorunl - 12.06.2015, 15:31

Forum Jump:


Users browsing this thread: 6 Guest(s)