MySQL register, help!
#1

I have this Mysql register system, and I've got it working pretty good, but it don't want to login the player if it is registered. I use MySQL R7 plugin.
Here is how it works, i do check if the it is any row with the name that the player have and the password as the player whrites:
Код:
if(response) //If the player clicked login
    {
        new query[200], pname[24], escapepass[100]; //
        GetPlayerName(playerid, pname, MAX_PLAYER_NAME); //Gets the players name
        mysql_real_escape_string(inputtext, escapepass); //We escape the inputtext to avoid SQL injections.
        format(query, sizeof(query), "SELECT * FROM playerinfo WHERE name = '%s' AND password = SHA1('%s')", pname, escapepass);
        mysql_function_query(dbHandle, query, true, "LoadPassword", "u", playerid);
    }
Then I here is my LoadPassword:
Код:
public LoadPassword(playerid){
    new rows, fields;
    cache_get_data(rows, fields);
    if(rows)
    {
        MySQL_Login(playerid);
        SendClientMessage(playerid, COLOR_YELLOW, "You have now logged in");
    }
    else{
        if (logintrys[playerid] < 5){
        	//This means that the password that the player
            //typed was incorrect and we will resend the dialog.
            ShowPlayerDialog(playerid, 15500, DIALOG_STYLE_PASSWORD, "Login","Your name is {FF0000}registered{FFFFFF}! Please {0000FF}login{FFFFFF} with your password below!\n{FF0000} The password you typed was incorrect!","Login","Cancel"); //Shows our login dialog :).
            SendClientMessage(playerid,COLOR_RED, "Invalid Password"); //Sends the client a error message
            logintrys[playerid] ++;
         }
         else{
            SendClientMessage(playerid, COLOR_RED, "You have been auto kicked becuse you have entered invalid password 5 times in a row, you can log in again if you want.");
			Kick(playerid);
   		}
    }
}
Will this check if there is any rows found with the password as they put in and the name they have?
When i log in Nothing happens and the MySQL_Login function does never got called, not the other either, it just dissapear and nothing happens :S

Someone knows what's wrong with this?
I'm very thankful for any help,
and if you got a better idea just tell me but I've not found any for MySQL R7 :S
Reply
#2

I've found the bug ^^ I did whrite wrong paramter on the LoadPassword MySQL_function_query (u) insted of (i) haha silly me, always remember to check that if you got any problems with mysql R7
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)