Login-System Bug - Jedes PW richtig

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Hallo Leute,
    ich habe bei meinem Script folgendes Problem:
    Wenn ich mich einlogge, und irgendein belibiges Passwort eingebe, loggt man sich ein, auch, wenn das PW falsch ist.
    Hier mal die Zeilen vom OnPlayerLogin:


    public OnPlayerLogin(playerid,const string[])
    {
    new string2[64];
    new string3[128];
    format(string2, sizeof(string2), "/User/%s.cer", ReadName(playerid));
    new File: UserFile = fopen(string2, io_read);
    if(UserFile)
    {
    new valtmp[128];
    fread(UserFile, valtmp);strmid(PlayerInfo[playerid][pPassword], valtmp, 0, strlen(valtmp)-1, 255);
    if((strcmp(PlayerInfo[playerid][pPassword], string, true, strlen(valtmp)-1) == 0))
    {
    new key[128],val[128];
    new Data[128];
    while(fread(UserFile,Data,sizeof(Data)))
    {
    key = ini_GetKey(Data);
    if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
    if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
    if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
    if( strcmp( key , "Bank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBank] = strval( val ); }
    if( strcmp( key , "Team" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pTeam] = strval( val ); }
    if( strcmp( key , "Leader" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLeader] = strval( val ); }
    if( strcmp( key , "Member" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMember] = strval( val ); }
    if( strcmp( key , "Rank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRank] = strval( val ); }
    if( strcmp( key , "Admin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
    if( strcmp( key , "Supporter" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSupporter] = strval( val ); }
    if( strcmp( key , "Skin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSkin] = strval( val ); }
    if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
    if( strcmp( key , "FSkin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFSkin] = strval( val ); }
    if( strcmp( key , "Knastzeit" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKnastzeit] = strval( val ); }
    if( strcmp( key , "Wanteds" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWanteds] = strval( val ); }
    if( strcmp( key , "Jailed" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJailed] = strval( val ); }
    if( strcmp( key , "JPoints" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJPoints] = strval( val ); }
    if( strcmp( key , "Knast" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKnast] = strval( val ); }
    if( strcmp( key , "Drogen" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDrogen] = strval( val ); }
    if( strcmp( key , "Materialien" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMaterials] = strval( val ); }
    if( strcmp( key , "Points" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPoint] = strval( val ); }
    if( strcmp( key , "Experince" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pExp] = strval( val ); }
    if( strcmp( key , "Duty" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDuty] = strval( val ); }
    if( strcmp( key , "Respekt" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRespekt] = strval( val ); }
    if( strcmp( key , "Nummer" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pNummer] = strval( val ); }
    if( strcmp( key , "Buch" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBuch] = strval( val ); }
    if( strcmp( key , "AutoLiz" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAutoLiz] = strval( val ); }
    if( strcmp( key , "BikeLiz" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBikeLiz] = strval( val ); }
    if( strcmp( key , "FlugLiz" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFlugLiz] = strval( val ); }
    if( strcmp( key , "WaffLiz" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWaffLiz] = strval( val ); }
    if( strcmp( key , "AnglLiz" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAnglLiz] = strval( val ); }
    if( strcmp( key , "BootLiz" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBootLiz] = strval( val ); }
    if( strcmp( key , "LKWLiz" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLKWLiz] = strval( val ); }
    if( strcmp( key , "Kopfgeld" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKopfgeld] = strval( val ); }
    if( strcmp( key , "Opfer" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pOpfer] = strval( val ); }
    if( strcmp( key , "Macher" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMacher] = strval( val ); }
    if( strcmp( key , "Auftrag" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAuftrag] = strval( val ); }
    if( strcmp( key , "Key" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKey] = strval( val ); }
    if( strcmp( key , "CarID" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCarID] = strval( val ); }
    }
    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
    fclose(UserFile);
    gPlayerLogged[playerid] = 1;
    gPlayerAccount[playerid] = 1;
    new kills = PlayerInfo[playerid][pLevel];
    SetPlayerScore(playerid, kills);
    format(string3, sizeof(string3), "*::* Willkommen %s, du hast dich erfolgreicht eingeloggt! *::*", ReadName(playerid));
    SendClientMessage(playerid, COLOR_WHITE,string3);
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, "*::* Falsches Passwort *::*");
    fclose(UserFile);
    }
    }
    return 1;
    }


    Hoffe ihr könnt mir schnell helfen!


    Mit freundlichen Grüßen,
    Gigg aka Max

  • if(response && strlen(inputtext) > 0)
    {
    OnPlayerLogin(playerid,inputtext);
    }
    else
    {
    ShowPlayerDialog(playerid,Login,DIALOG_STYLE_INPUT,"Einloggen","Es darf kein Leeres Textfeld Sein!\nBitte tippe dein Passwort in das TextFeld ein um dich einzuloggen:","Einloggen","Abbruch");
    return 1;
    }
    if(response == 1)
    {
    SendClientMessage(playerid,Farbe_ADM_CMD,"Du hast den Vorgang abgebrochen");
    Kick(playerid);
    }

    Einmal editiert, zuletzt von Xx[Kevin]xX ()

  • Unter die Dialog response!


    Deine Login ID raus suchen... einfügen fertig!


    aber warte fehler endeckt :D

  • if(response && strlen(inputtext) > 0)return OnPlayerLogin(playerid,inputtext);
    else return ShowPlayerDialog(playerid,Login,DIALOG_STYLE_INPUT,"Einloggen","Es darf kein Leeres Textfeld Sein!\nBitte tippe dein Passwort in das TextFeld ein um dich einzuloggen:","Einloggen","Abbruch");


    Erstens das ist kürzer zweitens zeig uns einfach den Code Abschnitt

    Mfg. BlackFoX_UD_ alias [BFX]Explosion


  • Poste mal dein


    public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

  • Also, hier nur der teil com login:


    else if(dialogid == 3)
    {
    if(!response) return 1;
    else
    {
    if(response == 1)
    {
    if(IsPlayerConnected(playerid))
    {
    if(strlen(inputtext) > 24 || strlen(inputtext) < 4)
    {
    SendClientMessage(playerid, COLOR_GREY, "*:: Das Passwort muss mindestens 4 und maximal 24 Buchstaben lang sein. ::*");
    SendClientMessage(playerid, COLOR_GREEN, "*:: Um das Einloggungs-Fenster wiederaufzurufen: *:: (/login) ::*");
    return 1;
    }
    else
    {
    if(ReadLogin(playerid))
    {
    SendClientMessage(playerid, COLOR_GREY, "*:: Du bist bereits eingeloggt ::*");
    return 1;
    }
    new pass[256];
    format(pass, 255, "%s", inputtext);
    Encrypt(pass);
    OnPlayerLogin(playerid, pass);
    /*if(PlayerInfo[playerid][pEingang] > 0)
    {
    new string[256];
    format(string, 256, "*:: Du hast %d neue Nachrichten! ::*", PlayerInfo[playerid][pEingang]);
    SendClientMessage(playerid, COLOR_GREY, string);
    }*/
    return 1;
    }
    }
    }
    else if(response == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN, "*:: Um das Einloggungs-Fenster wiederaufzurufen: *:: (/login) ::*");
    return 1;
    }
    }
    }
    else if(dialogid == 2)
    {
    if(!response) return 1;
    else
    {
    if(response == 1)
    {
    if(IsPlayerConnected(playerid))
    {
    if(strlen(inputtext) > 24 || strlen(inputtext) < 4)
    {
    SendClientMessage(playerid, COLOR_GREY, "*:: Das Passwort muss mindestens 4 und maximal 24 Buchstaben lang sein. ::*");
    SendClientMessage(playerid, COLOR_GREEN, "*:: Um das Registrierungs-Fenster wiederaufzurufen: *:: (/register) ::*");
    return 1;
    }
    else
    {
    if(ReadRegister(playerid))
    {
    SendClientMessage(playerid, COLOR_GREY, "*:: Du bist bereits registriert ::*");
    return 1;
    }
    new pass[256], string[256];
    format(pass, 256, "%s", PlayerInfo[playerid][pPassword]);
    Encrypt(pass);
    format(string, sizeof(string), "/User/%s.cer", ReadName(playerid));
    new File: file = fopen(string, io_read);
    if (file)
    {
    SendClientMessage(playerid, COLOR_GREY, "*::* Du bist bereits registriert *::*");
    fclose(file);
    return 1;
    }
    PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
    new File:hFile;
    hFile = fopen(string, io_append);
    new var[32];
    format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]); fwrite(hFile, var);
    format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]); fwrite(hFile, var);
    format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]); fwrite(hFile, var);
    format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]); fwrite(hFile, var);
    format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]); fwrite(hFile, var);
    format(var, 32, "Team=%d\n",PlayerInfo[playerid][pTeam]); fwrite(hFile, var);
    format(var, 32, "Leader=%d\n",PlayerInfo[playerid][pLeader]); fwrite(hFile, var);
    format(var, 32, "Member=%d\n",PlayerInfo[playerid][pMember]); fwrite(hFile, var);
    format(var, 32, "Rank=%d\n",PlayerInfo[playerid][pRank]); fwrite(hFile, var);
    format(var, 32, "Admin=%d\n",PlayerInfo[playerid][pAdmin]); fwrite(hFile, var);
    format(var, 32, "Supporter=%d\n",PlayerInfo[playerid][pSupporter]); fwrite(hFile, var);
    format(var, 32, "Skin=%d\n",PlayerInfo[playerid][pSkin]); fwrite(hFile, var);
    format(var, 32, "Level=%d\n",PlayerInfo[playerid][pLevel]); fwrite(hFile, var);
    format(var, 32, "FSkin=%d\n",PlayerInfo[playerid][pFSkin]); fwrite(hFile, var);
    format(var, 32, "Knastzeit=%d\n",PlayerInfo[playerid][pKnastzeit]); fwrite(hFile, var);
    format(var, 32, "Wanteds=%d\n",PlayerInfo[playerid][pWanteds]); fwrite(hFile, var);
    format(var, 32, "Jailed=%d\n",PlayerInfo[playerid][pJailed]); fwrite(hFile, var);
    format(var, 32, "JPoints=%d\n",PlayerInfo[playerid][pJPoints]); fwrite(hFile, var);
    format(var, 32, "Knast=%d\n",PlayerInfo[playerid][pKnast]); fwrite(hFile, var);
    format(var, 32, "Drogen=%d\n",PlayerInfo[playerid][pDrogen]); fwrite(hFile, var);
    format(var, 32, "Materialien=%d\n",PlayerInfo[playerid][pMaterials]); fwrite(hFile, var);
    format(var, 32, "Points=%d\n",PlayerInfo[playerid][pPoint]); fwrite(hFile, var);
    format(var, 32, "Experince=%d\n",PlayerInfo[playerid][pExp]); fwrite(hFile, var);
    format(var, 32, "Duty=%d\n",PlayerInfo[playerid][pDuty]); fwrite(hFile, var);
    format(var, 32, "Respekt=%d\n",PlayerInfo[playerid][pRespekt]); fwrite(hFile, var);
    format(var, 32, "Nummer=%d\n",PlayerInfo[playerid][pNummer]); fwrite(hFile, var);
    format(var, 32, "Buch=%d\n",PlayerInfo[playerid][pBuch]); fwrite(hFile, var);
    format(var, 32, "AutoLiz=%d\n",PlayerInfo[playerid][pAutoLiz]); fwrite(hFile, var);
    format(var, 32, "BikeLiz=%d\n",PlayerInfo[playerid][pBikeLiz]); fwrite(hFile, var);
    format(var, 32, "FlugLiz=%d\n",PlayerInfo[playerid][pFlugLiz]); fwrite(hFile, var);
    format(var, 32, "WaffLiz=%d\n",PlayerInfo[playerid][pWaffLiz]); fwrite(hFile, var);
    format(var, 32, "AnglLiz=%d\n",PlayerInfo[playerid][pAnglLiz]); fwrite(hFile, var);
    format(var, 32, "BootLiz=%d\n",PlayerInfo[playerid][pBootLiz]); fwrite(hFile, var);
    format(var, 32, "LKWLiz=%d\n",PlayerInfo[playerid][pLKWLiz]); fwrite(hFile, var);
    format(var, 32, "Kopfgeld=%d\n",PlayerInfo[playerid][pKopfgeld]); fwrite(hFile, var);
    format(var, 32, "Opfer=%d\n",PlayerInfo[playerid][pOpfer]); fwrite(hFile, var);
    format(var, 32, "Macher=%d\n",PlayerInfo[playerid][pMacher]); fwrite(hFile, var);
    format(var, 32, "Auftrag=%d\n",PlayerInfo[playerid][pAuftrag]); fwrite(hFile, var);
    format(var, 32, "Key=%d\n",PlayerInfo[playerid][pKey]); fwrite(hFile, var);
    format(var, 32, "CarID=%d\n",PlayerInfo[playerid][pCarID]); fwrite(hFile, var);
    fclose(hFile);
    SendClientMessage(playerid, COLOR_WHITE, "*::* Du hast dich erfolgreich registriert! *::* (/login) *::*");
    return 1;
    }
    }
    }
    else if(response == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN, "*:: Um das Registrierungs-Fenster wiederaufzurufen: *:: (/register) ::*");
    return 1;
    }
    }
    }

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen

  • Das ist jetzt die Userfile von mir


    E: Ganz oben ist eine Leerzeile