Login/Register MySQL not working
#1

edit: well login/register is working so far, but I have this error: I can enter ANY password to login, any suggestions?

PHP код:
    if(dialogid == iLoginDialog)
    {
        if(
response)
        {
            if(
strlen(inputtext) > 0)
            {
                new 
EscapedText[60];
                
mysql_real_escape_string(inputtextEscapedText);
                new 
len strlen(EscapedText);
                
format(Querysizeof(Query), "SELECT `Password` FROM `RL` WHERE `Username` = '%s';"pName);
                
mysql_query(Query);
                new 
result[60];
                
mysql_fetch_field_row(result"Password");
                if(
strcmp(EscapedTextresulttruelen) == 0)
                {
                    
TogglePlayerSpectating(playeridfalse);
                    return 
1;
                }
            }
            
ShowPlayerDialog(playeridiLoginDialogDIALOG_STYLE_PASSWORD"Login""Enter Your Password!""Login""Cancel");
        }
        else
            return 
0;
    } 
Reply
#2

Put this under mysql_query in OnPlayerConnect
pawn Код:
printf("User %d looked up in database with response %d", playerid, mysql_errno());
After you connect this will pop up in server console - if the response is diffrent than 0, then query returned an error.

On a sidenote: You've forgotten about executing query in login dialog.
Reply
#3

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Put this under mysql_query in OnPlayerConnect
pawn Код:
printf("User %d looked up in database with response %d", playerid, mysql_errno());
After you connect this will pop up in server console - if the response is diffrent than 0, then query returned an error.

On a sidenote: You've forgotten about executing query in login dialog.
response 2005, what now?
Reply
#4

Quote:

ERROR 2005 (HY000): Unknown MySQL server host 'XXX'

Your connection host is invalid
Reply
#5

Quote:
Originally Posted by Misiur
Посмотреть сообщение
Your connection host is invalid
my connection host is the same I'm using for my website, which is working fine, I guess I'll have to install mysql on pc ;/

edit: it's working, thanks!

edit2: well, I can enter ANY password to login, any suggestions?

PHP код:
    if(dialogid == iLoginDialog)
    {
        if(
response)
        {
            if(
strlen(inputtext) > 0)
            {
                new 
EscapedText[60];
                
mysql_real_escape_string(inputtextEscapedText);
                new 
len strlen(EscapedText);
                
format(Querysizeof(Query), "SELECT `Password` FROM `RL` WHERE `Username` = '%s';"pName);
                
mysql_query(Query);
                new 
result[60];
                
mysql_fetch_field_row(result"Password");
                if(
strcmp(EscapedTextresulttruelen) == 0)
                {
                    
TogglePlayerSpectating(playeridfalse);
                    return 
1;
                }
            }
            
ShowPlayerDialog(playeridiLoginDialogDIALOG_STYLE_PASSWORD"Login""Enter Your Password!""Login""Cancel");
        }
        else
            return 
0;
    } 
Reply
#6

You cant use website datebase for home server
Reply
#7

bump?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)