Login / Register problem
#1

I actually managed to fix this problem but due to a backup issue I had to revert to a VERY old version of my script and basically, when the user connects the script determine if the account exists, for some reason it says that unregistered accounts exist.

Here is the code:
pawn Код:
stock InitConnection(playerid)
{
    new Query[90], EscName[MAX_PLAYER_NAME];
    mysql_real_escape_string(pName(playerid), EscName);

    format(Query, sizeof(Query), "SELECT * FROM `playerinfo` WHERE `username` = '%s')", EscName);
    mysql_query(Query);
    mysql_store_result();

    if(mysql_num_rows() != 0)
    {
        format(Msg, sizeof(Msg), "Please enter your password below to log onto your account\n");
        DialogPassword(playerid, LOGIN, "Account Login", Msg, "Login", "Leave");
    }
    else
    {
        format(Msg, sizeof(Msg), "This account is not registered, please enter a password below to continue\n");
        DialogPassword(playerid, REGISTER, "Account Registration", Msg, "Register", "Leave");
    }
    mysql_free_result();
}
The rest of the register / login script works fine, so the problem is here. Any ideas?
Reply
#2

After playing around with the code I can get one of two results.

Either: All accounts seem registered, even when not.

Or: All accounts need to register, even when they exist.

I'm really stuck here, anyone willing to help?
Reply
#3

SELECT * FROM `playerinfo` WHERE `username` = '%s') to -> SELECT * FROM `playerinfo` WHERE `username` = '%s'
Reply
#4

Thanks, repped.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)