SA-MP Forums Archive
Login doesn't work anymore. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Login doesn't work anymore. (/showthread.php?tid=608224)



Login doesn't work anymore. - justjamie - 29.05.2016

hello.
i think i fucked up with some brackets here, i changed some, but i don't remember what i exactly did.
What's wrong about this code:
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid==DIALOG_REGISTER)
    {
    if(
response)
    {
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,sizeof(name));
    if(
strlen(inputtext)>3)
    {
    new 
query[600],wachtwoord[35],playerserial[128],playerip[32];
    
//register function
    
gpci(playerid,playerserial,sizeof(playerserial));
    
GetPlayerIp(playerid,playerip,32);
    
mysql_escape_string(inputtext,wachtwoord,dbhandle);
    
format(query,sizeof(query),"INSERT INTO user (username,password,power,level,skin,money,radio,freq1,freq2,freq3,freq4,freq5,playerteam,regip,reggpci,rpoints,playertime,bank)VALUES ('%s','%s','0','1','20','10000','0','666666','666666','666666','666666','666666','255','%s','%s','0','0','10000')",name,wachtwoord,playerip,playerserial);
    
mysql_function_query(dbhandle,query,false,"","",playerid);
       new 
query1[128];
    
mysql_escape_string(inputtext,wachtwoord,dbhandle);
    
format(query1,sizeof(query1),"SELECT * FROM user WHERE username='%s' AND password ='%s'",name,wachtwoord);
    
mysql_function_query(dbhandle,query1,true,"OnPasswordResponse","i",playerid);
    }
    }
    else
    {
    
Kick(playerid);
    }
    if(
dialogid==DIALOG_LOGIN)
    {
    if(
response)
    {
    new 
name[MAX_PLAYER_NAME],query[128],wachtwoord[35];
    
GetPlayerName(playerid,name,sizeof(name));
    
mysql_escape_string(inputtext,wachtwoord,dbhandle);
    
format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND password ='%s'",name,wachtwoord);
    
mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid);
    }
    else
    {
 
//niks ingegevoert
    
SendClientMessage(playerid,COLOR_RED,"Please enter your password.");
    
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Please enter your password","Confirm","Cancel");
    }
    }
 } 



Re: Login doesn't work anymore. - Dayrion - 29.05.2016

Why there is no indentation?
Try this :
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid==DIALOG_REGISTER)
    {
        if(
response)
        {
            new 
name[MAX_PLAYER_NAME];
            
GetPlayerName(playerid,name,sizeof(name));
            if(
strlen(inputtext)>3)
            new 
query[600],wachtwoord[35],playerserial[128],playerip[32];
            
//register function
            
gpci(playerid,playerserial,sizeof(playerserial));
            
GetPlayerIp(playerid,playerip,32);
            
mysql_escape_string(inputtext,wachtwoord,dbhandle);
            
format(query,sizeof(query),"INSERT INTO user (username,password,power,level,skin,money,radio,freq1,freq2,freq3,freq4,freq5,playerteam,regip,reggpci,rpoints,playertime,bank)VALUES ('%s','%s','0','1','20','10000','0','666666','666666','666666','666666','666666','255','%s','%s','0','0','10000')",name,wachtwoord,playerip,playerserial);
            
mysql_function_query(dbhandle,query,false,"","",playerid);
               new 
query1[128];
            
mysql_escape_string(inputtext,wachtwoord,dbhandle);
            
format(query1,sizeof(query1),"SELECT * FROM user WHERE username='%s' AND password ='%s'",name,wachtwoord);
            
mysql_function_query(dbhandle,query1,true,"OnPasswordResponse","i",playerid);
        }
        else
        {
            
Kick(playerid);
        }
    if(
dialogid==DIALOG_LOGIN)
     {
        if(
response)
        {
            new 
name[MAX_PLAYER_NAME],query[128],wachtwoord[35];
            
GetPlayerName(playerid,name,sizeof(name));
            
mysql_escape_string(inputtext,wachtwoord,dbhandle);
            
format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND password ='%s'",name,wachtwoord);
            
mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid);
        }
        else
        {
             
//niks ingegevoert
            
SendClientMessage(playerid,COLOR_RED,"Please enter your password.");
            
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Please enter your password","Confirm","Cancel");
        }
    }




Re: Login doesn't work anymore. - J0sh... - 29.05.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Why there is no indentation?
Try this :
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid==DIALOG_REGISTER)
    {
        if(
response)
        {
            new 
name[MAX_PLAYER_NAME];
            
GetPlayerName(playerid,name,sizeof(name));
            if(
strlen(inputtext)>3)
            new 
query[600],wachtwoord[35],playerserial[128],playerip[32];
            
//register function
            
gpci(playerid,playerserial,sizeof(playerserial));
            
GetPlayerIp(playerid,playerip,32);
            
mysql_escape_string(inputtext,wachtwoord,dbhandle);
            
format(query,sizeof(query),"INSERT INTO user (username,password,power,level,skin,money,radio,freq1,freq2,freq3,freq4,freq5,playerteam,regip,reggpci,rpoints,playertime,bank)VALUES ('%s','%s','0','1','20','10000','0','666666','666666','666666','666666','666666','255','%s','%s','0','0','10000')",name,wachtwoord,playerip,playerserial);
            
mysql_function_query(dbhandle,query,false,"","",playerid);
               new 
query1[128];
            
mysql_escape_string(inputtext,wachtwoord,dbhandle);
            
format(query1,sizeof(query1),"SELECT * FROM user WHERE username='%s' AND password ='%s'",name,wachtwoord);
            
mysql_function_query(dbhandle,query1,true,"OnPasswordResponse","i",playerid);
        }
        else
        {
            
Kick(playerid);
    }
    if(
dialogid==DIALOG_LOGIN)
     {
        if(
response)
        {
            new 
name[MAX_PLAYER_NAME],query[128],wachtwoord[35];
            
GetPlayerName(playerid,name,sizeof(name));
            
mysql_escape_string(inputtext,wachtwoord,dbhandle);
            
format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND password ='%s'",name,wachtwoord);
            
mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid);
        }
        else
        {
             
//niks ingegevoert
            
SendClientMessage(playerid,COLOR_RED,"Please enter your password.");
            
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Please enter your password","Confirm","Cancel");
        }
    }

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid==DIALOG_REGISTER)
    {
        if(
response)
        {
            new 
name[MAX_PLAYER_NAME];
            
GetPlayerName(playerid,name,sizeof(name));
            if(
strlen(inputtext)>3)
            new 
query[600],wachtwoord[35],playerserial[128],playerip[32];
            
//register function
            
gpci(playerid,playerserial,sizeof(playerserial));
            
GetPlayerIp(playerid,playerip,32);
            
mysql_escape_string(inputtext,wachtwoord,dbhandle);
            
format(query,sizeof(query),"INSERT INTO user (username,password,power,level,skin,money,radio,freq1,freq2,freq3,freq4,freq5,playerteam,regip,reggpci,rpoints,playertime,bank)VALUES ('%s','%s','0','1','20','10000','0','666666','666666','666666','666666','666666','255','%s','%s','0','0','10000')",name,wachtwoord,playerip,playerserial);
            
mysql_function_query(dbhandle,query,false,"","",playerid);
               new 
query1[128];
            
mysql_escape_string(inputtext,wachtwoord,dbhandle);
            
format(query1,sizeof(query1),"SELECT * FROM user WHERE username='%s' AND password ='%s'",name,wachtwoord);
            
mysql_function_query(dbhandle,query1,true,"OnPasswordResponse","i",playerid);
        }
        else
        {
            
Kick(playerid);
        }
    }
    if(
dialogid==DIALOG_LOGIN)
     {
        if(
response)
        {
            new 
name[MAX_PLAYER_NAME],query[128],wachtwoord[35];
            
GetPlayerName(playerid,name,sizeof(name));
            
mysql_escape_string(inputtext,wachtwoord,dbhandle);
            
format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND password ='%s'",name,wachtwoord);
            
mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid);
        }
        else
        {
             
//niks ingegevoert
            
SendClientMessage(playerid,COLOR_RED,"Please enter your password.");
            
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Please enter your password","Confirm","Cancel");
        }
    }

You had a missing bracket.


Re: Login doesn't work anymore. - Dayrion - 29.05.2016

Quote:
Originally Posted by Jamester
Посмотреть сообщение
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid==DIALOG_REGISTER)
    {
        if(
response)
        {
            new 
name[MAX_PLAYER_NAME];
            
GetPlayerName(playerid,name,sizeof(name));
            if(
strlen(inputtext)>3)
            new 
query[600],wachtwoord[35],playerserial[128],playerip[32];
            
//register function
            
gpci(playerid,playerserial,sizeof(playerserial));
            
GetPlayerIp(playerid,playerip,32);
            
mysql_escape_string(inputtext,wachtwoord,dbhandle);
            
format(query,sizeof(query),"INSERT INTO user (username,password,power,level,skin,money,radio,freq1,freq2,freq3,freq4,freq5,playerteam,regip,reggpci,rpoints,playertime,bank)VALUES ('%s','%s','0','1','20','10000','0','666666','666666','666666','666666','666666','255','%s','%s','0','0','10000')",name,wachtwoord,playerip,playerserial);
            
mysql_function_query(dbhandle,query,false,"","",playerid);
               new 
query1[128];
            
mysql_escape_string(inputtext,wachtwoord,dbhandle);
            
format(query1,sizeof(query1),"SELECT * FROM user WHERE username='%s' AND password ='%s'",name,wachtwoord);
            
mysql_function_query(dbhandle,query1,true,"OnPasswordResponse","i",playerid);
        }
        else
        {
            
Kick(playerid);
        }
    }
    if(
dialogid==DIALOG_LOGIN)
     {
        if(
response)
        {
            new 
name[MAX_PLAYER_NAME],query[128],wachtwoord[35];
            
GetPlayerName(playerid,name,sizeof(name));
            
mysql_escape_string(inputtext,wachtwoord,dbhandle);
            
format(query,sizeof(query),"SELECT * FROM user WHERE username='%s' AND password ='%s'",name,wachtwoord);
            
mysql_function_query(dbhandle,query,true,"OnPasswordResponse","i",playerid);
        }
        else
        {
             
//niks ingegevoert
            
SendClientMessage(playerid,COLOR_RED,"Please enter your password.");
            
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Please enter your password","Confirm","Cancel");
        }
    }

You had a missing bracket.
Yep, thanks for the correction.


Re: Login doesn't work anymore. - justjamie - 29.05.2016

welp the last 3 brackets had to be somewhere else.
/resolved.