Jump to content

Recommended Posts

Posted

Salut! Eu lucrez la un edit pe gamemode-ul lui RullZ, adica XSW si am o problema cu sistemul de logare.

Cand intru pe server, ma inregistrez, ma adauga in baza de date la "accounts", imi incarca tot (Pornesc GM-ul cu XAMPP pentru a-l testa), iar apoi, cand dau un relog, imi da Autentificare si nu imi mai recunoaste parola, nici macar daca copiez parola din baza de date.

Baza de date este conectata corect... Nu stiu ce as putea sa-i fac, daca ma poate ajuta cineva, eu las Sistemul de Logare aici:

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

        case Account_D: // Login
        {
            if(response)
            {
                Str[0] = '\0'; Str2[0] = '\0'; mysql_real_escape_string(inputtext, Str, DB_Connect);
                //--------------------------------------------------------------
                format(Str2, 300, "SELECT * FROM `Accounts` WHERE `Name` = '%s' AND `Password` = SHA1('%s')", ReturnName(playerid), Str),
                mysql_tquery(DB_Connect, Str2, "CheckPassword", "d", playerid);
            }
            if(!response)
            {
                Str[0] = '\0'; format(Str, 450, "{00FF00}Hi, {00BBF6}%s{00FF00}!\n{00FF00}Please enter the new name before:", ReturnName(playerid));
                //--------------------------------------------------------------
                ShowPlayerDialog(playerid, Account_D + 3, DIALOG_STYLE_INPUT, "Change {FF0000}Name", Str, "Change", "Leave");
            }
        }

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

public CheckPassword(playerid, Password[])
{
    new sStr[2], Str3[500]; Str[0] = '\0'; Str2[0] = '\0';
    //--------------------------------------------------------------------------
    cache_get_data(sStr[0], sStr[1], DB_Connect);
    //--------------------------------------------------------------------------
    if(!sStr[0])
    {
        if(Player[playerid][Language] == 1)
        {
            Player[playerid][FailedLogins][1]++;
            //------------------------------------------------------------------
            format(Str2, 500, "{FF0000}Autentificare esuata (%d/4)!\n\n{FFCC00}Ai introdus o parola gresita! Te rugam sa incerci dinnou!\n{FFFF00}Daca ti-ai uitat parola, viziteaza {FF0000}www.cs-gothics.com {FFFF00}pentru a o reseta!", Player[playerid][FailedLogins][1]);
            strcat(Str3, Str2, 500);
            //------------------------------------------------------------------
            ShowPlayerDialog(playerid, Account_D, DIALOG_STYLE_PASSWORD, "Autentificare", Str3, "Autentificare", "Nume Nou");
        }
        else if(Player[playerid][Language] == 2)
        {
            Player[playerid][FailedLogins][1]++;
            //------------------------------------------------------------------
            format(Str2, 500, "{FF0000}Login failed (%d/4)!\n\n{FFCC00}You have entered a wrong password! Please try again!\n{FFFF00}If you forgot your password, visit {FF0000}www.cs-gothics.com {FFFF00}to reset it!", Player[playerid][FailedLogins][1]),
            strcat(Str3, Str2, 500);
            //------------------------------------------------------------------
            ShowPlayerDialog(playerid, Account_D, DIALOG_STYLE_PASSWORD, "Login", Str3, "Login", "New Name");
        }
          //----------------------------------------------------------------------
          if(Player[playerid][FailedLogins][1] == 4)
        {
            format(Str2, 300, "*** {FF0000}%s {CEC8C8}has been kicked {FF0000}(Failed Logins)! {CEC8C8}***", ReturnName(playerid)),
            //------------------------------------------------------------------
            SendClientMessageToAll(GREY, Str2), SetTimerEx("KickEx", 50, false, "d", playerid);
        }
        return 0;
    }
    //--------------------------------------------------------------------------
       format(Str, 300, "SELECT * FROM `Accounts` WHERE `Name` = '%s'", ReturnName(playerid));
       mysql_tquery(DB_Connect, Str, "LoadPlayerData", "d", playerid);
    //--------------------------------------------------------------------------
    return 1;
}

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.