Dialog LoginHelp
#1

i input correct my password, but always considered wrong..
can help?

PHP код:
public OnPlayerConnect(playerid)
    {
        
        
Info[playerid][Admin] = 0;
        
Info[playerid][Score] = 0;
        
Info[playerid][DMScore] = 0;
        
Info[playerid][FRScore] = 0;
        
Info[playerid][inDM] = 0;
        
Info[playerid][inDMZone] = 0;
        
Info[playerid][Skin] = 0;
        
Info[playerid][MB] = 0;
        
Info[playerid][God] = 0;
        
Info[playerid][Money] = 0;
        
Info[playerid][Color] = 0;
        
SendDeathMessage(INVALID_PLAYER_ID,playerid200);
        
        if (
fexist(UserBanPath(playerid)))
        {
            
INI_ParseFile(UserBanPath(playerid), "loadban_%s", .bExtra true, .extra playerid);
            if (
Info[playerid][Banned] == 1)
            {
                new 
str1[400];
                
format(str1sizeof(str1), ""ORANGE"You are banned from the server!\nBan Time: "GREY"Permanent\n"RED"Admin who banned you: "GREY"%s\n"ORANGE"Reason: "GREY"%s\n\n{F2DD3F}Were you banned unfairly or do you want to get unbanned? Make an unban appeal at "GREEN"bfesamp.tk{F2DD3F}!"Info[playerid][BanAdmin], Info[playerid][BanReason]);
                
ShowPlayerDialog(playeridDIALOG_BANDIALOG_STYLE_MSGBOX""RED"You are banned!"str1"OK""");
                
SetTimerEx("KickPlayer"100false"i"playerid);
                return 
1;
            }
            else
            {
                new 
d,m,y,h,mi,sstr2[400];
                
TimestampToDate(Info[playerid][BanExpire],y,m,d,h,mi,s,0,0);
                if(
gettime()>Info[playerid][BanExpire])
                {
                    
fremove(UserBanPath(playerid));
                    
SendClientMessage(playerid, -1""CYAN"SERVER: Your ban has expired. You are now unbanned from the server.");
                }
                
format(str2sizeof(str2), ""ORANGE"You are banned from the server!\nBan Expire: "GREY"%i/%i/%i [DD/MM/YY] | %i:%i\n"ORANGE"Admin who banned you: "GREY"%s\n"RED"Reason: "GREY"%s\n\n{F2DD3F}Were you banned unfairly or do you want to get unbanned? Make an unban appeal at "GREEN"www.bfesamp.tk{F2DD3F}!"dmyhmi,Info[playerid][BanAdmin], Info[playerid][BanReason]);
                
ShowPlayerDialog(playeridDIALOG_TEMPBANDIALOG_STYLE_MSGBOX""RED"You are banned!"str2"OK""");
                
SetTimerEx("KickPlayer"100false"i"playerid);
            }
        }
        
        else if(
fexist(Path(playerid)))
        {
            
            
INI_ParseFile(Path(playerid), "loadaccount_user", .bExtra true, .extra playerid);
            
            
            
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD""RED"BFE - Login"""WHITE"Type your password below to login.""Login""Quit");
            
            new 
file[256];
            new 
name[24];
            
GetPlayerName(playerid,name,24);
            
format(file,sizeof(file),"Users/%s.ini",name);
            if(!
fexist(file))
            {
                for(new 
i;i<MAX_OSLOTS;i++)
                {
                    if(
IsPlayerAttachedObjectSlotUsed(playeridi))
                    {
                        
aInfo[playerid][i][Amodel]=0;
                        
aInfo[playerid][i][Abone]=0;
                        
aInfo[playerid][i][AfOffsetX]=0;
                        
aInfo[playerid][i][AfOffsetY]=0;
                        
aInfo[playerid][i][AfOffsetZ]=0;
                        
aInfo[playerid][i][AfRotX]=0;
                        
aInfo[playerid][i][AfRotY]=0;
                        
aInfo[playerid][i][AfRotZ]=0;
                        
aInfo[playerid][i][AfScaleY]=0;
                        
aInfo[playerid][i][AfScaleZ]=0;
                    }
                }
            }
        }
        
        else
        {
            
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT""GREEN"BFE - Register"""WHITE"Type your password below to register a new account.""Register""Quit");
            
            
            
        }
        
//Default values of vehicle settings
        
AutoRepair[playerid] = 1;
        
SBvalue[playerid] = 1.5;
        
Nitro[playerid] = 1;
        
VJump[playerid]=1;
        
AntiFall[playerid] = 1;
        
pms[playerid] = 1;
        Goto[
playerid] = 1;
        
Info[playerid][God] = 0;
        
PrisonTime[playerid] = 0;
        
Info[playerid][Jailed] = 0;
        
////////////////////////////////////////
        
        //TEXT DRAWS///////////////////////////
        
TextDrawShowForPlayer(playeridbfetop);
        
TextDrawShowForPlayer(playeridbfecmds);
        
TextDrawShowForPlayer(playeridwebsite);
        
////////////////////////////////////////
        
        
Info[playerid][inDM] = 0;
        
        
        return 
1;
    } 
PHP код:
if (dialogid == DIALOG_LOGIN)
        {
            if(!
response) return Kick(playerid);
            if(
response)
            {
                new 
pass[129];
                
WP_Hash(pass129inputtext);
                if(!
strcmp(passInfo[playerid][Pass], false))
                {
                    
INI_ParseFile(Path(playerid), "loadaccount_%s", .bExtra true, .extra playerid);
                    
SendClientMessage(playerid, -1""GREEN"You have successfully logged in.");
                    
Info[playerid][Logged] = 1;
                    
SpawnPlayer(playerid);
                    
Info[playerid][Spawned] = 1;
                    
SetPlayerColor(playeridInfo[playerid][Color]);
                    
SetPlayerScore(playerid,Info[playerid][Score]);
                    
GivePlayerMoney(playerid,Info[playerid][Money]);
                }
                
                else
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD""RED"Login"""WHITE"You have entered an incorrect password.\nType your password below to login.""Login""Quit");
                }
                
            }
            
        } 
Reply
#2

Wanna know magic? Enter nothing and bomm, you're inside of anyones account.

The strcmp() can't compare null with something else and then it will return true. But the real problem here is that you're not getting the players password anywhere.. You're checking if they exist, but you're not gathering any data such as pass etc.
Reply
#3

Quote:
Originally Posted by Luicy.
Посмотреть сообщение
Wanna know magic? Enter nothing and bomm, you're inside of anyones account.

The strcmp() can't compare null with something else and then it will return true.
Thank God you're not a magician. What you said doesn't apply here because OP compares stored password against hashed input, which is guaranteed to be a non-null string.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)