SA-MP Forums Archive
MySQL Login/register error - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL Login/register error (/showthread.php?tid=301867)



MySQL Login/register error - xMichaelx - 06.12.2011

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