Jump to content

Problema System Login


S0NNIX

Recommended Posts

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;
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.