Problem In Login System
#1

Hello,

I Need A Little Help I Am Having A Problem That If I Don't Write Any Password And Click On Login Button It Login Me In With That Name Please help Me How To Fix It.What Code i Should Show u For Fixing This Error
Reply
#2

Can you show your register dialog and your login dialog?

Specifically your register and login under OnDialogResponse
Reply
#3

Quote:
Originally Posted by Tass007
Посмотреть сообщение
Can you show your register dialog and your login dialog?

Specifically your register and login under OnDialogResponse
Here is it
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","{FF0000}You have entered an invalid password.\n""Type your password below to register a new account.","Register","Quit");
				dini_Create(UserPath(playerid));
				dini_Set(UserPath(playerid),"Password",inputtext);
                dini_IntSet(UserPath(playerid),"Cash",0);
                dini_IntSet(UserPath(playerid),"Admin",0);
                dini_IntSet(UserPath(playerid),"Kills",0);
                dini_IntSet(UserPath(playerid),"Deaths",0);
                dini_IntSet(UserPath(playerid),"WantedLevel",0);
                dini_IntSet(UserPath(playerid),"Vip",0);
                dini_IntSet(UserPath(playerid),"Score",0);
                dini_IntSet(UserPath(playerid),"Condoms",0);
                dini_IntSet(UserPath(playerid),"Banned",0);
                dini_IntSet(UserPath(playerid),"Jailed",0);
                dini_IntSet(UserPath(playerid),"Drugs",0);
                dini_IntSet(UserPath(playerid),"Nopm",0);
                dini_IntSet(UserPath(playerid),"Bank",0);
                dini_IntSet(UserPath(playerid),"Sausages",0);
                dini_IntSet(UserPath(playerid),"PassChange",0);
                dini_IntSet(UserPath(playerid),"Mute",0);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"{008000}Success!","{FF0000}Registered and autologged! Now all your data are saved. (Money,score,robberies,wanted level etc)","Ok","");
			}
        }

        case DIALOG_LOGIN:
        {
            if (!response) return Kick(playerid);
            if( response )
            {
              	if(!strcmp(inputtext, dini_Get(UserPath(playerid), "Password")))
				{
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"{008000}Success!","{FFFF00}You have successfully logged in!","Ok","");
                }
                else
                {
                   ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","{FF0000}You have entered an incorrect password.\n""Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
Reply
#4

PHP код:
case DIALOG_LOGIN:
        {
            if (!
response) return Kick(playerid);
            if( 
response )
            {
                  if(!
strcmp(inputtextdini_Get(UserPath(playerid), "Password"false)))
                {
                    
ShowPlayerDialog(playeridDIALOG_SUCCESS_2DIALOG_STYLE_MSGBOX,"{008000}Success!","{FFFF00}You have successfully logged in!","Ok","");
                }
                else
                {
                   
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,"Login","{FF0000}You have entered an incorrect password.\n""Type your password below to login.","Login","Quit");
                }
                return 
1;
            }
        }
    } 
That may work. Also you aren't hashing any passwords; that isn't good for security reasons.
Reply
#5

You don't check if the password the player inputted is empty.

PHP код:
case DIALOG_LOGIN:
{
    if (!
response) return Kick(playerid);
    if (!
inputtext[0] || strcmp(inputtextdini_Get(UserPath(playerid), "Password"))) return ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT"Login""{FF0000}You have entered an incorrect password.\nType your password below to login.""Login""Quit");
    
ShowPlayerDialog(playeridDIALOG_SUCCESS_2DIALOG_STYLE_MSGBOX"{008000}Success!""{FFFF00}You have successfully logged in!""Ok""");
    return 
1;

Reply
#6

Getting One Warning Fix Please
Quote:

C:\Users\Anurag\Desktop\3G CNR\gamemodes\3GCNR.pwn(6005) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.

By Using This Code
Код:
   case DIALOG_LOGIN:
        {
            if (!response) return Kick(playerid);
            if( response )
            {
                  if(!strcmp(inputtext, dini_Get(UserPath(playerid), "Password", false)))
                {
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"{008000}Success!","{FFFF00}You have successfully logged in!","Ok","");
                }
                else
                {
                   ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","{FF0000}You have entered an incorrect password.\n""Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
Reply
#7

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid )
    {
        case 
DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT"Registering...","{FF0000}You have entered an invalid password.\n""Type your password below to register a new account.","Register","Quit");
                    
dini_Create(UserPath(playerid));
                    
dini_Set(UserPath(playerid),"Password",inputtext);
                    
dini_IntSet(UserPath(playerid),"Cash",0);
                    
dini_IntSet(UserPath(playerid),"Admin",0);
                    
dini_IntSet(UserPath(playerid),"Kills",0);
                    
dini_IntSet(UserPath(playerid),"Deaths",0);
                    
dini_IntSet(UserPath(playerid),"WantedLevel",0);
                    
dini_IntSet(UserPath(playerid),"Vip",0);
                    
dini_IntSet(UserPath(playerid),"Score",0);
                    
dini_IntSet(UserPath(playerid),"Condoms",0);
                    
dini_IntSet(UserPath(playerid),"Banned",0);
                    
dini_IntSet(UserPath(playerid),"Jailed",0);
                    
dini_IntSet(UserPath(playerid),"Drugs",0);
                    
dini_IntSet(UserPath(playerid),"Nopm",0);
                    
dini_IntSet(UserPath(playerid),"Bank",0);
                    
dini_IntSet(UserPath(playerid),"Sausages",0);
                    
dini_IntSet(UserPath(playerid),"PassChange",0);
                    
dini_IntSet(UserPath(playerid),"Mute",0);
                    
ShowPlayerDialog(playeridDIALOG_SUCCESS_1DIALOG_STYLE_MSGBOX,"{008000}Success!","{FF0000}Registered and autologged! Now all your data are saved. (Money,score,robberies,wanted level etc)","Ok","");
                }
            }
        }
        case 
DIALOG_LOGIN
        { 
            if (!
response) return Kick(playerid); 
            if (!
inputtext[0] || strcmp(inputtextdini_Get(UserPath(playerid), "Password"))) return ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT"Login""{FF0000}You have entered an incorrect password.\nType your password below to login.""Login""Quit"); 
            
ShowPlayerDialog(playeridDIALOG_SUCCESS_2DIALOG_STYLE_MSGBOX"{008000}Success!""{FFFF00}You have successfully logged in!""Ok"""); 
        }
    }
    return 
1

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)