Login / Reg. Verschlüsselung

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
  • Hey Ho ihr da^^


    ich bin ja bestimmt wie ihr mitbekommen habt dabei eine Mod zu schreiben.^^ nun bei meinem Reg.system was ich habe besser gesagt was ich mir anschau wie sowas funktiniert steht das drinne:


    Encrypt(inputtext);
    new string2[128];
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    format(string2, sizeof(string2), Acc_Ordner, playername2);
    new File: UserFile = fopen(string2, io_read);
    if ( UserFile )
    {
    new PassData[256];
    new keytmp[256], valtmp[256];
    fread( UserFile , PassData , sizeof( PassData ) );
    keytmp = ini_GetKey( PassData );
    if( strcmp( keytmp , "Password" , true ) == 0 )
    {
    valtmp = ini_GetValue( PassData );
    strmid(AccountInfo[playerid][aPassword], valtmp, 0, strlen(valtmp)-1, 255);
    }
    if(strcmp(AccountInfo[playerid][aPassword],inputtext, true ) == 0)
    {
    if(strlen(inputtext))
    {
    for(new p = 0; p < strlen(AccountInfo[playerid][aPassword]); p++)
    {
    inputtext[p] = '?';
    }
    new key[256] , val[256];
    new Data[256];
    while ( fread( UserFile , Data , sizeof( Data ) ) )
    {
    key = ini_GetKey( Data );



    stock ini_GetKey( line[] )
    {
    new keyRes[256];
    keyRes[0] = 0;
    if ( strfind( line , "=" , true ) == -1 ) return keyRes;
    strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) );
    return keyRes;
    }


    stock ini_GetValue( line[] )
    {
    new valRes[256];
    valRes[0]=0;
    if ( strfind( line , "=" , true ) == -1 ) return valRes;
    strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) );
    return valRes;
    }


    Encrypt(string[])
    {
    for(new x=0; x < strlen(string); x++)
    {
    string[x] += (3^x) * (x % 15);
    if(string[x] > (0xff))
    {
    string[x] -= 256;
    }
    }
    }


    nun habe ich k.A. was da abläuft... wenn einer von euch mir das erklären könnte wäre das sehr sehr geil.


    hier mal der volle abschnitt.
    [hide]if(dialogid == RegLogin)
    {
    Encrypt(inputtext);
    new string2[128];
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    format(string2, sizeof(string2), Acc_Ordner, playername2);
    new File: UserFile = fopen(string2, io_read);
    if ( UserFile )
    {
    new PassData[256];
    new keytmp[256], valtmp[256];
    fread( UserFile , PassData , sizeof( PassData ) );
    keytmp = ini_GetKey( PassData );
    if( strcmp( keytmp , "Password" , true ) == 0 )
    {
    valtmp = ini_GetValue( PassData );
    strmid(AccountInfo[playerid][aPassword], valtmp, 0, strlen(valtmp)-1, 255);
    }
    if(strcmp(AccountInfo[playerid][aPassword],inputtext, true ) == 0)
    {
    if(strlen(inputtext))
    {
    for(new p = 0; p < strlen(AccountInfo[playerid][aPassword]); p++)
    {
    inputtext[p] = '?';
    }
    new key[256] , val[256];
    new Data[256];
    while ( fread( UserFile , Data , sizeof( Data ) ) )
    {
    key = ini_GetKey( Data );
    if(SAVE_MONEY_SCORE_FIGHT_DRUNK == 1)
    {
    if( strcmp( key , "Money" , true ) == 0 )
    {
    val = ini_GetValue( Data );
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid,strval(val));
    }
    if( strcmp( key , "Score" , true ) == 0 )
    {
    val = ini_GetValue( Data );
    SetPlayerScore(playerid,strval(val));
    }
    if( strcmp( key , "DrunkLevel" , true ) == 0 )
    {
    val = ini_GetValue( Data );
    SetPlayerDrunkLevel(playerid,strval(val));
    }
    if( strcmp( key , "FightStyle" , true ) == 0 )
    {
    val = ini_GetValue( Data );
    SetPlayerFightingStyle(playerid,strval(val));
    }
    }
    if(SAVE_POS == 1)
    {
    if( strcmp( key , "PositionX" , true ) == 0 )
    {
    val = ini_GetValue( Data );
    PositionInfo[playerid][aPosX] = strval(val);
    }
    if( strcmp( key , "PositionY" , true ) == 0 )
    {
    val = ini_GetValue( Data );
    PositionInfo[playerid][aPosY] = strval(val);
    }
    if( strcmp( key , "PositionZ" , true ) == 0 )
    {
    val = ini_GetValue( Data );
    PositionInfo[playerid][aPosZ] = strval(val);
    }
    SetPlayerPos(playerid, PositionInfo[playerid][aPosX], PositionInfo[playerid][aPosY], PositionInfo[playerid][aPosZ]);
    if( strcmp( key , "Angle" , true ) == 0 )
    {
    val = ini_GetValue( Data );
    PositionInfo[playerid][aAngle] = strval(val);
    }
    if( strcmp( key , "Interior" , true ) == 0 )
    {
    val = ini_GetValue( Data );
    SetPlayerInterior(playerid, strval(val));
    }
    SetPlayerFacingAngle(playerid, PositionInfo[playerid][aAngle]);
    }
    if(SAVE_HEALTH == 1)
    {
    if( strcmp( key , "Health" , true ) == 0 )
    {
    val = ini_GetValue( Data );
    SetPlayerHealth(playerid, strval(val));
    }
    }
    if(SAVE_ARMOUR == 1)
    {
    if( strcmp( key , "Armour" , true ) == 0 )
    {
    val = ini_GetValue( Data );
    SetPlayerArmour(playerid, strval(val));
    }
    }
    if(SAVE_WEAPON == 1)
    {
    new silah[128];
    new mermi[128];
    ResetPlayerWeapons(playerid);
    for(new slot = 0; slot != 12; slot++)
    {
    format(silah,sizeof(silah),"Weapon%s",slot);
    if( strcmp( key , silah, true ) == 0 )
    {
    val = ini_GetValue( Data );
    strmid(WeaponInfo[playerid][slot], val, 0, strlen(val));
    }
    }
    for(new slot = 0; slot != 12; slot++)
    {
    format(mermi,sizeof(mermi),"Weapon%sAmmo",slot);
    if( strcmp( key , mermi, true ) == 0 )
    {
    val = ini_GetValue( Data );
    strmid(AmmoInfo[playerid][slot], val, 0, strlen(val));
    }
    }
    for(new slot = 0; slot != 12; slot++)
    {
    GivePlayerWeapon(playerid, WeaponInfo[playerid][slot], AmmoInfo[playerid][slot]);
    }
    if( strcmp( key , "ArmedWeapon" , true ) == 0 )
    {
    val = ini_GetValue( Data );
    SetPlayerArmedWeapon(playerid, strval(val));
    }
    }
    }
    register[playerid] = 0;
    login[playerid] = 0;
    AccountInfo[playerid][aLogged] = 1;
    printf("%s is logged in.",playername2);
    fclose(UserFile);
    }
    }
    else
    {
    if(strlen(inputtext))
    {
    new girismsg[256];
    printf("%s is used the wrong password.",playername2);
    format(girismsg,256,"WRONG PASSWORD\n\nPlease enter your password:");
    ShowPlayerDialog(playerid,Login,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
    login[playerid] = 1;
    register[playerid] = 0;
    failedlogin[playerid]++;
    fclose(UserFile);
    return 1;
    }
    }
    if(!strlen(inputtext))
    {
    new girismsg[256];
    printf("%s did not enter the password.",playername2);
    format(girismsg,256,"WRONG PASSWORD\n\nPlease enter your password:");
    ShowPlayerDialog(playerid,Login,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
    login[playerid] = 1;
    register[playerid] = 0;
    failedlogin[playerid]++;
    fclose(UserFile);
    return 1;
    }
    }
    }
    [/hide]

    5 Mal editiert, zuletzt von Mischi ()