if(dialogid == iLoginDialog)
{
if(response)
{
if(strlen(inputtext) > 0)
{
new EscapedText[60];
mysql_real_escape_string(inputtext, EscapedText);
new len = strlen(EscapedText);
format(Query, sizeof(Query), "SELECT `Password` FROM `RL` WHERE `Username` = '%s';", pName);
mysql_query(Query);
new result[60];
mysql_fetch_field_row(result, "Password");
if(strcmp(EscapedText, result, true, len) == 0)
{
TogglePlayerSpectating(playerid, false);
return 1;
}
}
ShowPlayerDialog(playerid, iLoginDialog, DIALOG_STYLE_PASSWORD, "Login", "Enter Your Password!", "Login", "Cancel");
}
else
return 0;
}
printf("User %d looked up in database with response %d", playerid, mysql_errno());
Put this under mysql_query in OnPlayerConnect
pawn Код:
On a sidenote: You've forgotten about executing query in login dialog. |
ERROR 2005 (HY000): Unknown MySQL server host 'XXX' |
if(dialogid == iLoginDialog)
{
if(response)
{
if(strlen(inputtext) > 0)
{
new EscapedText[60];
mysql_real_escape_string(inputtext, EscapedText);
new len = strlen(EscapedText);
format(Query, sizeof(Query), "SELECT `Password` FROM `RL` WHERE `Username` = '%s';", pName);
mysql_query(Query);
new result[60];
mysql_fetch_field_row(result, "Password");
if(strcmp(EscapedText, result, true, len) == 0)
{
TogglePlayerSpectating(playerid, false);
return 1;
}
}
ShowPlayerDialog(playerid, iLoginDialog, DIALOG_STYLE_PASSWORD, "Login", "Enter Your Password!", "Login", "Cancel");
}
else
return 0;
}