Password check with mysql problem
#1

My problem:


Код:
CheckPassword(playerid, password[])
{
    new query[255], password_escaped[25];
    if(strlen(password) > 0)
	{
	    mysql_escape_string(password, password_escaped, db_handle);
	    format(query, sizeof(query), "SELECT * FROM user WHERE username='%s' AND password='%s'",                       getPlayerName(playerid), password_escaped);
	    mysql_function_query(db_handle, query, TRUE, "OnPasswordCheck", "i", playerid);
	}
	else
	{
	       return 0;
	}
}
forward OnPasswordCheck(playerid);
public OnPasswordCheck(playerid)
{
	new num_fields, num_rows;
	cache_get_data(num_rows, num_fields, db_handle);
	if(num_rows == 1)
	{
	    //Passwort richtig
            return 1;
	}
	else
	{
	    //Passwort falsch
            return 0;
	}
}

I want that CheckPassword does return me the truth.

How can I get the returned data from the query to my function?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)