mySQL Coding
#1

pawn Код:
case 1:
        {
            if(!response)
            {
                SendClientMessage(playerid, COLOR_BRIGHTRED, "You selected exit, therefore you were kicked.");
                Kick(playerid);
            }
            else if(strlen(inputtext) == 0)
            {
                SendClientMessage(playerid, COLOR_BRIGHTRED, "You must input the password to your account! If this is not your account, come back with a new name!");
                ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login / Authentication Process", "Hello there!\n\nPlease enter your password to authenticate.", "Login", "Cancel");
            }
            else
            {
                new name[24], Escape[2][128];
                GetPlayerName(playerid, name, 24);
                mysql_real_escape_string(name, Escape[0]); // This function makes sure you don't get MySQL injected. Read about it by searching it on ******.
                mysql_real_escape_string(inputtext, Escape[1]);
                format(Query, sizeof(Query), "SELECT * FROM phpbb_users WHERE username = '%s' AND user_password = md5('%s')", Escape[0], Escape[1]);
                mysql_query(Query);
                mysql_store_result();

                if(mysql_num_rows())
                {
                    PlayerStats[playerid][pAuth] = 1;
                    LoadAccountVariables(playerid);

                    format(string, sizeof(string), "|- Welcome, %s! You have successfully logged in! -|", GetName(playerid));
                    SendClientMessage(playerid, COLOR_LIGHTGREEN, string);

                    TogglePlayerSpectating(playerid, false);

                    SetSpawnInfo(playerid, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
                    SpawnPlayer(playerid);

                    // -----[Let's Show Some TD's]----- //

                    TextDrawShowForPlayer(playerid, Textdraw0);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "Incorrect password. Please try again!");
                    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login / Authentication Process", "Hello there!\n\nPlease enter your password to authenticate.", "Login", "Cancel");
                }
            }
        }
Getting wrong password no matter what I do, something wrong with this code? Compiles correctly.

Thanks,
Ryan
Reply


Messages In This Thread
mySQL Coding - by Moglizorz. - 11.11.2010, 22:28
Re: mySQL Coding - by TheXIII - 11.11.2010, 22:29
Re: mySQL Coding - by The_Gangstas - 11.11.2010, 22:35
Re: mySQL Coding - by Moglizorz. - 11.11.2010, 22:49
Re: mySQL Coding - by Lenny the Cup - 11.11.2010, 22:51
Re: mySQL Coding - by TheXIII - 11.11.2010, 22:53

Forum Jump:


Users browsing this thread: 1 Guest(s)