Player can login with any password (even the wrong pass)
#1

pawn Код:
#include <a_samp>
#include <YSI\y_ini>
#include <YSI\y_iterate>
#include <sscanf2>
#include <streamer>
#include <zcmd>
#include <geolocation>
#include <strlib>
The dialog accepts any input, even the wrong input.

pawn Код:
//... OnDialogResponse
if(dialogid == dregister)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(!strlen(inputtext))
            {
                ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
            }
            else
            {
                new hashpass[129];
                WP_Hash(hashpass,sizeof(hashpass),inputtext);
                new INI:file = INI_Open(Path(playerid));
                INI_SetTag(file,"data");
                INI_WriteString(file,"Password",hashpass);
                INI_WriteInt(file,"Admin",PlayerInfo[playerid][Admin] = 0);
                INI_WriteInt(file,"Donator",PlayerInfo[playerid][Donator] = 0);
                INI_WriteInt(file,"Money",PlayerInfo[playerid][Money] = 0);
                INI_WriteInt(file,"Level",PlayerInfo[playerid][Level] = 0);
                INI_WriteInt(file,"Kills",PlayerInfo[playerid][Kills] = 0);
                INI_WriteInt(file,"Deaths",PlayerInfo[playerid][Deaths] = 0);
                INI_WriteInt(file,"Registered",PlayerInfo[playerid][Registered] = 0);//
                INI_WriteInt(file,"MaskOwned",PlayerInfo[playerid][MaskOwned] = 0);
                INI_WriteInt(file,"Jailed",PlayerInfo[playerid][Jailed] = 0);
                INI_WriteInt(file,"JailedTime",PlayerInfo[playerid][JailedTime] = 0);
                INI_WriteInt(file,"Faction",PlayerInfo[playerid][Faction] = 0);
                INI_WriteInt(file,"FactionRank",PlayerInfo[playerid][FactionRank] = 0);
                INI_WriteInt(file,"BanAppealMod",PlayerInfo[playerid][BanAppealMod] = 0);
                INI_WriteInt(file,"Health", 100);
                INI_WriteInt(file,"Banned",PlayerInfo[playerid][Banned] = 0);
                INI_Close(file);
                ServerInfo[TotalRegisteredPlayers]++;
                ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Register","Thank you for registering at Los Santos Life Roleplay.\nWe hope you enjoy your stay here.\nBefore we commence, you will need to do an RP quiz.","Let's go!","Fuck this shite!");
            }
            return 1;
        }
    }
else if(dialogid == dlogin)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new HashPass[129];
            WP_Hash(HashPass, sizeof(HashPass), inputtext);
            if(strcmp(HashPass, PlayerInfo[playerid][Pass]) == 0)
            {
                INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);

                new string[128], country[256], city[256];
                GetPlayerCity(playerid, city, sizeof(city));
                GetPlayerCountry(playerid, country, sizeof(country));
                SetPlayerScore(playerid,PlayerInfo[playerid][Level]);
                GivePlayerMoney(playerid,PlayerInfo[playerid][Money]);
                SetPlayerHealth(playerid, PlayerInfo[playerid][Health]);
                SetPlayerArmour(playerid, PlayerInfo[playerid][Armour]);
                SetSpawnInfo(playerid, 0, 0, 216.17, 1822.77, 6.37, 0, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                new randmask = 10000 + random(99999);
                MaskNumber[playerid] = randmask;
                if(PlayerInfo[playerid][Banned] == 1)
                {
                    SendClientMessageEx(playerid, SAMP, "* This account is currently banned.");
                    return Ban(playerid);
                }
                if(PlayerInfo[playerid][Registered] == 0)
                {
                    return ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Register","It appears your account is not fully registered.\nBefore you can play, you will need to do an RP quiz.","Let's go!","Fuck this shite!");
                }
                Logged[playerid] = 1;
                SendClientMessageEx(playerid,-1,"Welcome back! You have successfully logged in");
                format(string, sizeof(string), "[LOGIN] %s has just logged in. (Location: %s, %s)", GetName(playerid), city, country);
                SendAdminMessage(YELLOW, string, 1);
            }
            else if(!strlen(inputtext))
            {
                ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Register","Welcome! This account is registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
            }
            else
            {
                if(WrongPassword[playerid] == 3)
                {
                    Kick(playerid);
                }
                new diastr[128];
                WrongPassword[playerid] += 1;
                format(diastr, 128, "Wrong Password! (%d/3)\nInsert your password to login to your account.", WrongPassword[playerid]);
                ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login",diastr,"Login","Quit");
                return 1;
            }
        }
    }
Reply
#2

pawn Код:
else if(!strlen(inputtext))
{
    ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
}
If he writes nothing you send him register dialog?

Have you given "PlayerInfo[playerid][Pass]" any value before this?
Reply
#3

Quote:
Originally Posted by Fabio11
Посмотреть сообщение
pawn Код:
else if(!strlen(inputtext))
{
    ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
}
If he writes nothing you send him register dialog?

Have you given "PlayerInfo[playerid][Pass]" any value before this?
I can show you the register dialog? (I'll add it in a sec)

[Edit] Added the Registration dialog.
Reply
#4

hows about loading the data before you compare strings?

Код:
 INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
 if(strcmp(HashPass, PlayerInfo[playerid][Pass]) == 0)
Reply
#5

Quote:
Originally Posted by arbit
Посмотреть сообщение
hows about loading the data before you compare strings?

Код:
 INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);
 if(strcmp(HashPass, PlayerInfo[playerid][Pass]) == 0)
I do not think that it will solve it, But I'll try it.

[Edit] Nope, did not work at all, same results as before (any password is accepted).
Reply
#6

@seanny - show how your getting information from the file. (loading the data.)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)