My Login system is accepting any password.
#1

Hello, my login system is accepting any password, it should only be accepting the password that is in the file.

pawn Код:
public OnPlayerLogin(playerid,password[])
{
   
    new string2[128], string[256], passkey[256];
    format(string2, sizeof(string2), "users/%s.ini", PlayerName(playerid));

    format(passkey, sizeof(passkey), "%s", dini_Get(string2, "Key"));

    if(strcmp(passkey,password, true ) == 0 )
    {
        PlayerInfo[playerid][pCash] = dini_Int(string2,"Cash");
        PlayerInfo[playerid][pLevel] = dini_Int(string2,"Level");
        PlayerInfo[playerid][pAccount] = dini_Int(string2,"Account");
        PlayerInfo[playerid][pAdmin] = dini_Int(string2,"AdminLevel");
        PlayerInfo[playerid][pAdminPIN] = dini_Int(string2,"AdminPIN");
        PlayerInfo[playerid][pSpecial] = dini_Int(string2,"Special");
        PlayerInfo[playerid][pExp] = dini_Int(string2,"Respect");
        PlayerInfo[playerid][gPupgrade] = dini_Int(string2,"UpgradePoints");
        PlayerInfo[playerid][pKills] = dini_Int(string2,"Kills");
        PlayerInfo[playerid][pSHealth] = dini_Float(string2,"pSHealth");
        PlayerInfo[playerid][pHealth] = dini_Float(string2,"Health");
        PlayerInfo[playerid][pPos_x] = dini_Float(string2,"Pos_x");
        PlayerInfo[playerid][pPos_y] = dini_Float(string2,"Pos_y");
        PlayerInfo[playerid][pPos_z] = dini_Float(string2,"Pos_z");
        PlayerInfo[playerid][pInt] = dini_Int(string2,"Int");
        PlayerInfo[playerid][pLocal] = dini_Int(string2,"Local");
        PlayerInfo[playerid][pModel] = dini_Int(string2,"Char");
        PlayerInfo[playerid][pPnumber] = dini_Int(string2,"PhoneNr");
        PlayerInfo[playerid][pHousekey] = dini_Int(string2,"pHouseKey");
        PlayerInfo[playerid][pPbiskey] = dini_Int(string2,"Bizz");
        PlayerInfo[playerid][pBanned] = dini_Int(string2,"Banned");
        PlayerInfo[playerid][pFightSkill] = dini_Int(string2,"FightSkill");
        PlayerInfo[playerid][pSex] = dini_Int(string2,"Sex");
        PlayerInfo[playerid][pAge] = dini_Int(string2,"Age");
        PlayerInfo[playerid][pTut] = dini_Int(string2,"Tutorial");
        PlayerInfo[playerid][pMember] = dini_Int(string2,"Member");
        PlayerInfo[playerid][pDivision] = dini_Int(string2,"Division");
        PlayerInfo[playerid][pRank] = dini_Int(string2,"Rank");
        PlayerInfo[playerid][pCrashed] = dini_Int(string2,"Crashed");
        if(PlayerInfo[playerid][pCrashed]==1) {
        PlayerInfo[playerid][pGun1] = dini_Int(string2,"Gun1");
        PlayerInfo[playerid][pGun2] = dini_Int(string2,"Gun2");
        PlayerInfo[playerid][pGun3] = dini_Int(string2,"Gun3");
        PlayerInfo[playerid][pGun4] = dini_Int(string2,"Gun4");
        PlayerInfo[playerid][pGun5] = dini_Int(string2,"Gun5");
        PlayerInfo[playerid][pGun6] = dini_Int(string2,"Gun6");
        PlayerInfo[playerid][pGun7] = dini_Int(string2,"Gun7");
        PlayerInfo[playerid][pGun8] = dini_Int(string2,"Gun8");
        PlayerInfo[playerid][pGun9] = dini_Int(string2,"Gun9");
        PlayerInfo[playerid][pGun10] = dini_Int(string2,"Gun10");
        PlayerInfo[playerid][pGun11] = dini_Int(string2,"Gun11");
        PlayerInfo[playerid][pGun12] = dini_Int(string2,"Gun12");
        PlayerInfo[playerid][pGun13] = dini_Int(string2,"Gun13");
        PlayerInfo[playerid][pAmmo1] = dini_Int(string2,"Ammo1");
        PlayerInfo[playerid][pAmmo2] = dini_Int(string2,"Ammo2");
        PlayerInfo[playerid][pAmmo3] = dini_Int(string2,"Ammo3");
        PlayerInfo[playerid][pAmmo4] = dini_Int(string2,"Ammo4");
        PlayerInfo[playerid][pAmmo5] = dini_Int(string2,"Ammo5");
        PlayerInfo[playerid][pAmmo6] = dini_Int(string2,"Ammo6");
        PlayerInfo[playerid][pAmmo7] = dini_Int(string2,"Ammo7");
        PlayerInfo[playerid][pAmmo8] = dini_Int(string2,"Ammo8");
        PlayerInfo[playerid][pAmmo9] = dini_Int(string2,"Ammo9");
        PlayerInfo[playerid][pAmmo10] = dini_Int(string2,"Ammo10");
        PlayerInfo[playerid][pAmmo11] = dini_Int(string2,"Ammo11");
        PlayerInfo[playerid][pAmmo12] = dini_Int(string2,"Ammo12");
        PlayerInfo[playerid][pAmmo13] = dini_Int(string2,"Ammo13");
        }
        PlayerInfo[playerid][pJob] = dini_Int(string2,"Job");
        PlayerInfo[playerid][pPayCheck] = dini_Int(string2,"PayCheck");
        PlayerInfo[playerid][pPayDay] = dini_Int(string2,"PayDay");
        PlayerInfo[playerid][pDonateRank] = dini_Int(string2,"DonateRank");
        PlayerInfo[playerid][pConnectTime] = dini_Int(string2,"ConnectTime");
        PlayerInfo[playerid][pDonateTime] = dini_Int(string2,"DonateTime");
        PlayerInfo[playerid][pJailed] = dini_Int(string2,"Jailed");
        PlayerInfo[playerid][pJailTime] = dini_Int(string2,"JailTime");
        PlayerInfo[playerid][pDrugs] = dini_Int(string2,"Drugs");
        PlayerInfo[playerid][pMetals] = dini_Int(string2,"Metals");
        PlayerInfo[playerid][pVaultOwned] = dini_Int(string2,"VaultOwned");
        PlayerInfo[playerid][pVaultDrugs] = dini_Int(string2,"VaultDrugs");
        PlayerInfo[playerid][pVaultMats] = dini_Int(string2,"VaultMats");
        PlayerInfo[playerid][pWatch] = dini_Int(string2,"Watch");
        PlayerInfo[playerid][pMegaphone] = dini_Int(string2,"Megaphone");
        PlayerInfo[playerid][pPhoneBook] = dini_Int(string2,"PhoneBook");
        PlayerInfo[playerid][pDrivLic] = dini_Int(string2,"CarLic");
        PlayerInfo[playerid][pLicensePoints] = dini_Int(string2,"LicensePoints");
        PlayerInfo[playerid][pCarkey] = dini_Int(string2,"Car");
        PlayerInfo[playerid][pCarkey2] = dini_Int(string2,"Car2");
        PlayerInfo[playerid][pCarkey3] = dini_Int(string2,"Car3");
        PlayerInfo[playerid][pMarried] = dini_Int(string2,"Married");
        PlayerInfo[playerid][pHelper] = dini_Int(string2,"Helper");
        PlayerInfo2[WantedLevel][playerid] = dini_Int(string2,"WantedLevel");
        PlayerInfo[playerid][pGunLic] = dini_Int(string2,"GunLic");
        PlayerInfo[playerid][pCrimes] = dini_Int(string2,"Crimes");
        PlayerInfo[playerid][pArrested] = dini_Int(string2,"Arrested");
        string = dini_Get(string2, "MarriedTo");
        strmid(PlayerInfo[playerid][pMarriedTo], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Taunt");
        strmid(PlayerInfo[playerid][pTaunt], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Crime1");
        strmid(PlayerInfo[playerid][pCrime1], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Crime2");
        strmid(PlayerInfo[playerid][pCrime2], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Crime3");
        strmid(PlayerInfo[playerid][pCrime3], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Crime4");
        strmid(PlayerInfo[playerid][pCrime4], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Crime5");
        strmid(PlayerInfo[playerid][pCrime5], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Crime6");
        strmid(PlayerInfo[playerid][pCrime6], string, 0, strlen(string), 255);
        for(new i = 0; i < 12; i++)
        {
            format(string, sizeof(string), "InvWeapon%d", GraffitiTime[playerid]);
            PlayerInfo[playerid][pInvWeapon][i] = dini_Int(string2,"InvWeapon");
        }
        for(new i = 0; i < 12; i++)
        {
            PlayerInfo[playerid][pInvAmmo][i] = 0;

        }
        PlayerInfo[playerid][pInvAmmo] = dini_Int(string2,"InvAmmo");
        PlayerInfo[playerid][pInvBeer] = dini_Int(string2,"InvBeer");
        PlayerInfo[playerid][pInvWine] = dini_Int(string2,"InvWine");
        PlayerInfo[playerid][pInvCiggy] = dini_Int(string2,"InvCiggy");
        PlayerInfo[playerid][pHidden] = dini_Int(string2,"Hidden");
        PlayerInfo[playerid][pWalkie] = dini_Int(string2,"Walkie");
        PlayerInfo[playerid][pWalkieFreq] = dini_Int(string2,"WalkieFreq");
        PlayerInfo[playerid][pLighter] = dini_Int(string2,"Lighter");
        PlayerInfo[playerid][pCigs] = dini_Int(string2,"Cigs");
        string = dini_Get(string2, "BanReason");
        strmid(PlayerInfo[playerid][pBanReason], string, 0, strlen(string), 255);
        string = dini_Get(string2, "BannedBy");
        strmid(PlayerInfo[playerid][pBannedBy], string, 0, strlen(string), 255);
        string = dini_Get(string2, "BannedIP");
        strmid(PlayerInfo[playerid][pBannedIP], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Fishes1");
        strmid(PlayerInfo[playerid][pFishes1], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Fishes2");
        strmid(PlayerInfo[playerid][pFishes2], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Fishes3");
        strmid(PlayerInfo[playerid][pFishes3], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Fishes4");
        strmid(PlayerInfo[playerid][pFishes4], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Fishes5");
        strmid(PlayerInfo[playerid][pFishes5], string, 0, strlen(string), 255);
        PlayerInfo[playerid][pFish][0] = dini_Int(string2,"Fish1");
        PlayerInfo[playerid][pFish][1] = dini_Int(string2,"Fish2");
        PlayerInfo[playerid][pFish][2] = dini_Int(string2,"Fish3");
        PlayerInfo[playerid][pFish][3] = dini_Int(string2,"Fish4");
        PlayerInfo[playerid][pFish][4] = dini_Int(string2,"Fish5");
        PlayerInfo[playerid][pNote1s] = dini_Int(string2,"Note1s");
        PlayerInfo[playerid][pNote2s] = dini_Int(string2,"Note2s");
        PlayerInfo[playerid][pNote3s] = dini_Int(string2,"Note3s");
        PlayerInfo[playerid][pNote4s] = dini_Int(string2,"Note4s");
        PlayerInfo[playerid][pNote5s] = dini_Int(string2,"Note5s");
        string = dini_Get(string2, "Note1");
        strmid(PlayerInfo[playerid][pNote1], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Note2");
        strmid(PlayerInfo[playerid][pNote2], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Note3");
        strmid(PlayerInfo[playerid][pNote3], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Note4");
        strmid(PlayerInfo[playerid][pNote4], string, 0, strlen(string), 255);
        string = dini_Get(string2, "Note5");
        strmid(PlayerInfo[playerid][pNote5], string, 0, strlen(string), 255);
        PlayerInfo2[JobDelay][playerid] = dini_Int(string2,"JobDelay");
        string = dini_Get(string2, "Accent");
        strmid(PlayerInfo[playerid][pAccent], string, 0, strlen(string), 255);
        PlayerInfo[playerid][pVoted] = dini_Int(string2,"Voted2");
        string = dini_Get(string2, "AdmName");
        strmid(PlayerInfo[playerid][pAdmName], string, 0, strlen(string), 255);
        PlayerInfo[playerid][pHeadValue] = dini_Int(string2,"HeadValue");
        PlayerInfo[playerid][pHiddenNum] = dini_Int(string2,"HiddenNum");
        PlayerInfo[playerid][pSkate] = dini_Int(string2,"Skate");
        PlayerInfo[playerid][pRadio] = dini_Int(string2,"Radio");
        PlayerInfo[playerid][pTicket][0] = dini_Int(string2,"Ticket0");
        PlayerInfo[playerid][pTicket][1] = dini_Int(string2,"Ticket1");
        PlayerInfo[playerid][pTicket][2] = dini_Int(string2,"Ticket2");
        PlayerInfo[playerid][pTicket][3] = dini_Int(string2,"Ticket3");
        PlayerInfo[playerid][pTicket][4] = dini_Int(string2,"Ticket4");
        string = dini_Get(string2, "TicketReason0");
        strmid(PlayerInfo[playerid][pTicketReason0], string, 0, strlen(string), 255);
        string = dini_Get(string2, "TicketReason1");
        strmid(PlayerInfo[playerid][pTicketReason1], string, 0, strlen(string), 255);
        string = dini_Get(string2, "TicketReason2");
        strmid(PlayerInfo[playerid][pTicketReason2], string, 0, strlen(string), 255);
        string = dini_Get(string2, "TicketReason3");
        strmid(PlayerInfo[playerid][pTicketReason3], string, 0, strlen(string), 255);
        string = dini_Get(string2, "TicketReason4");
        strmid(PlayerInfo[playerid][pTicketReason4], string, 0, strlen(string), 255);
        string = dini_Get(string2, "JailReason");
        strmid(PlayerInfo[playerid][pJailReason], string, 0, strlen(string), 255);
        string = dini_Get(string2, "App");
        strmid(PlayerInfo[playerid][pApp], string, 0, strlen(string), 255);
        PlayerInfo[playerid][pChanges] = dini_Int(string2,"Changes");
        PlayerInfo[playerid][pPhoneChanges] = dini_Int(string2,"PhoneChanges");
        PlayerInfo[playerid][pFamNum] = dini_Int(string2,"FamNum");
        string = dini_Get(string2, "Tattoo");
        strmid(PlayerInfo[playerid][pTattoo], string, 0, strlen(string), 255);
        PlayerInfo[playerid][pCellphone] = dini_Int(string2,"Cellphone");
        PlayerInfo[playerid][pCelltime] = dini_Int(string2,"Celltime");
        PlayerInfo[playerid][pCellplan] = dini_Int(string2,"Cellplan");
        PlayerInfo[playerid][pDonerGate1] = dini_Int(string2,"DonerGate1");
        PlayerInfo[playerid][pBreakAllow] = dini_Int(string2,"BreakAllow");
        PlayerInfo[playerid][pDonatorCarDate] = dini_Int(string2,"DonateCarDate");
        PlayerInfo[playerid][pWarrant] = dini_Int(string2,"Warrant");
        string = dini_Get(string2, "WarrentReason");
        PlayerInfo[playerid][pFactionIden] = dini_Int(string2,"FactionIdent");
        strmid(PlayerInfo[playerid][pWarrantReason], string, 0, strlen(string), 255);
        PlayerInfo[playerid][pGunSkill] = dini_Int(string2,"GunSkill");
        PlayerInfo[playerid][pDriverSus] = dini_Int(string2,"DriverSus");
        PlayerInfo[playerid][pGuide] = dini_Int(string2,"Guide");
        PlayerInfo[playerid][pAJails] = dini_Int(string2,"AJails");
        PlayerInfo[playerid][pBans] = dini_Int(string2,"Bans");
        PlayerInfo[playerid][pKicks] = dini_Int(string2,"Kicks");
        PlayerInfo[playerid][pWater] = dini_Int(string2,"Water");
        PlayerInfo[playerid][pChem] = dini_Int(string2,"Chem");
        if(PlayerInfo[playerid][pCrashed] != 0)
        {
            PlayerInfo2[HouseEntered][playerid] = dini_Int(string2,"HouseEntered");
            PlayerInfo2[IntEntered][playerid] = dini_Int(string2,"IntEntered");
            PlayerInfo[playerid][pWorld] = dini_Int(string2,"World");
            PlayerInfo[playerid][pCrashArmour] = dini_Float(string2,"CrashArmour");
            PlayerInfo[playerid][pCrashHealth] = dini_Float(string2,"CrashHealth");
            PlayerInfo[playerid][pMask] = dini_Int(string2,"Mask");
            PlayerInfo[playerid][pMaskUse] = dini_Int(string2,"MaskUse");
        }
        if(PlayerInfo[playerid][pDonateRank] != 0)
        {
            PlayerInfo[playerid][pMask] = dini_Int(string2,"Mask");
        }
    }
    else
    {
        if(PlayerInfo2[WrongPass][playerid] < 3)
        {
            SendClientMessage(playerid, LIGHTRED, "ERROR: Invalid Password.");
            PlayerInfo2[WrongPass][playerid]++;
        }
        else
        {
            Kick(playerid);
            PlayerInfo2[WrongPass][playerid] = 0;
        }
        return 1;
    }
    LoadLoginStuff(playerid);
    return 1;
}
I think the problem is here.
Reply
#2

DEBUG! Good god, isn't there a tutorial on debugging yet?
Reply
#3

if(strcmp(passkey,password, true ) == 0 )
{

strcmp returns 0 on correct string.
Reply
#4

This happened with the same on my server. I don't know what I done. Somehow, I just fixed it without even knowing!
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
DEBUG! Good god, isn't there a tutorial on debugging yet?
Make one!

@OP: This is the correct answer:

Quote:
Originally Posted by tyler12
Посмотреть сообщение
if(strcmp(passkey,password, true ) == 0 )
{

strcmp returns 0 on correct string.
So instead of doing this:

pawn Код:
if(strcmp(passkey,password, true))
You need to see if strcmp returns false/0, in which case, the strings match!

pawn Код:
if(!strcmp(passkey,password, true))
Reply
#6

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Make one!

@OP: This is the correct answer:



So instead of doing this:

pawn Код:
if(strcmp(passkey,password, true))
You need to see if strcmp returns false/0, in which case, the strings match!

pawn Код:
if(!strcmp(passkey,password, true))
[Edit] Nevermind, I fixed the problem!

[Error] I put "tmp" var in OnDialogResponse instead of inputtext, silly me! :P

L&A (lock and archive)! :X
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)