MySQL Login/register error
#1

Hey,

For some reason when a player registers and then gos to login they can't it just says "incorrect pass"
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        if(dialogid == DIALOG_REGISTER)
        {
            if(!response)
            {
                SendClientMessage(playerid,COLOR_RED,"You Must Register To Play");
                ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Los Santos Cops And Robbers",""COL_WHITE"Welcome To Los Santos Cops And Robbers!\nPlease Register With A Password Below!\nOnce Registered We Wish You The Best!"COL_RED"\nYou Must Register Below To Play","Register","Cancel");
            }
            if(response)
            {
                if(!strlen(inputtext) || strlen(inputtext) > 32)
                {
                    ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Los Santos Cops And Robbers","You Have Entered An Incorrect Password\nPlease Enter One Between 1-32 Chars","Register","Cancel");
                }
                else if(strlen(inputtext) > 0 && strlen(inputtext) < 32)
                {
                new escpass[100];
                mysql_real_escape_string(inputtext, escpass);
                MySQL_Register(playerid, escpass);
                }
            }
        }
        if(dialogid == DIALOG_LOGIN)
        {
            if(!response)
            {
                SendClientMessage(playerid,COLOR_RED,"You Must Login Before You Can Play");
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Los Santos Cops And Robbers",""COL_WHITE"Welcome Back!\nPlease Login Using Your Password!\nIn Order To Reload All Your Stats!"COL_WHITE"You Must Be Logged In To Play","Login","Cancel");
            }
            if(response)
            {
            new query[200], pname[24], escapepass[100];
            GetPlayerName(playerid, pname, 24);
            mysql_real_escape_string(inputtext, escapepass);
            format(query, sizeof(query), "SELECT `Username` FROM PlayerInfo WHERE Username = '%s' AND Password = SHA1('%s')", pname, escapepass);
            mysql_query(query);
            mysql_store_result();
            new numrows = mysql_num_rows();
            if(numrows == 1) MySQL_Login(playerid);
            if(!numrows)
            {
            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Los Santos Cops And Robbers",""COL_WHITE"Welcome Back!\nPlease Login Using Your Password!\nIn Order To Reload All Your Stats!"COL_WHITE"You Must Be Logged In To Play","Login","Cancel");
            SendClientMessage(playerid, COLOR_RED, "Incorrect password!");
            }
            mysql_free_result();
            }
        }
        return 1;
}
Thats my login and register dialog please tell me if you need anymore code
Reply


Messages In This Thread
MySQL Login/register error - by xMichaelx - 06.12.2011, 05:08

Forum Jump:


Users browsing this thread: 1 Guest(s)