sscanf format broken MySQL
#5

The error appears upon login. I can't find sscanf(query...), maybe I've accidentaly deleted it :S

Код:
	if(dialogid == DIALOG_LOGIN)
	{
	    if(!isnull(inputtext))
	    {
	        new EscapeString[3][MAX_PLAYER_NAME], password[30];

			GetPlayerIp(playerid, EscapeString[1], MAX_PLAYER_NAME);

			GetPlayerName(playerid, pData[playerid][Name], MAX_PLAYER_NAME);
			mysql_real_escape_string(EscapeString[1], EscapeString[2]); // used to prevent SQL-Injections.
	        mysql_real_escape_string(pData[playerid][Name], EscapeString[0]); // used to prevent SQL-Injections.

			mysql_debug(1);
			format(bigstr, sizeof(bigstr), "SELECT `password` FROM `satc players` WHERE `name` = '%s'", EscapeString[0]);
			mysql_query(bigstr);
			mysql_store_result();

			mysql_fetch_row(password);

			printf("[DEBUG]: Password: %s", password);

			mysql_free_result();
			mysql_debug(0);

			format(bigstr, sizeof(bigstr), "SELECT * FROM `satc players` WHERE `name` = '%s'", EscapeString[0]);
			mysql_query(bigstr);
			mysql_store_result();

			if(!strcmp(password, inputtext, true))
			{
			    mysql_fetch_row(bigstr);
				printf("[DEBUG]: bigstr: %s", bigstr);
			    if(!unformat(bigstr,"e<p<|>s[24]s[25]s[16]ddffddddddds[50]ddddd>", pData[playerid])) 
				{
				    if(pData[playerid][Banned] == 1)
				    {
				        format(str, sizeof(str), "[Auto Kick] %s has been automaticlly kicked. (Reason: Ban Evading)", pData[playerid][Name]);
						SendClientMessageToAll(COLOR_ALERT, str);

						format(str, sizeof(str), "You have been banned from %s Community...", GLOBAL_SERVER_NAME);
						SendClientMessage(playerid, COLOR_ADMIN, str);
						format(str, sizeof(str), "Your IP: %s", pData[playerid][IP]);
						SendClientMessage(playerid, COLOR_ADMIN, str);
						format(str, sizeof(str), "Please visit http://%s for unban appeals and provide this information in the appeal.", GLOBAL_SERVER_WEBSITE);
						SendClientMessage(playerid, COLOR_ADMIN, str);

						printf("[LOGIN]: Playerid (%d) Is a banned username, auto kicked !", playerid);
						Kick(playerid);
						return 1;
					}

                    SendClientMessage(playerid, COLOR_SUCCESS, ">> You are now logged in!");

                    if(pData[playerid][Level] >= 1)
                    {
						format(str, sizeof(str), "SATC Bot: %s %s has joined the server.", aData[pData[playerid][Level]][Name], pData[playerid][Name]);
						SendClientMessageToAll(COLOR_GREEN, str);
					}
					else
					{
					    format(str, sizeof(str), "SATC Bot: Player %s has joined the server.", pData[playerid][Name]);
    					SendClientMessageToAll(COLOR_GREEN, str);
					}
					
				    format(str, sizeof(str), "Welcome back %s.", pData[playerid][Name]);
					SendClientMessage(playerid, COLOR_LIGHTGREEN, str);
					SendClientMessage(playerid, COLOR_LIGHTGREEN, "[Forums: http://forum.sa-transport.com/ || TeamSpeak 3: 109.104.82.144:9987]");
					SendClientMessage(playerid, COLOR_LIGHTGREEN, "Enjoy your stay at San Andreas Transport Clan!");

					pData[playerid][Bools] |= PLAYER_LOGGED; // Turning the bit PLAYER_LOGGED ON.

					if(pData[playerid][Muted] == 1)
					{
					    pData[playerid][Bools] |= PLAYER_MUTED;
					}
					if(pData[playerid][Jailed] == 1)
					{
					    pData[playerid][Bools] |= PLAYER_JAILED;
					}

                    SetSpawnInfo(playerid, GetPlayerTeam(playerid), pData[playerid][Skins][0], sData[pData[playerid][Loc]][x], sData[pData[playerid][Loc]][y], sData[pData[playerid][Loc]][z], sData[pData[playerid][Loc]][r], 0, 0, 0, 0, 0, 0);
					SpawnPlayer(playerid);
					SetPlayerInterior(playerid, sData[pData[playerid][Loc]][interior]);
					SetCameraBehindPlayer(playerid);

					format(bigstr, sizeof(bigstr), "UPDATE `satc players` SET `ip` = '%s' WHERE `name` = '%s'", EscapeString[2], EscapeString[0]);
					mysql_query(bigstr);
					mysql_free_result();

				    printf("[LOGIN]: Playerid (%d) Logged in!", playerid);
				    return 1;
				}
				printf("[LOGIN]: Playerid (%d) ERROR! MYSQL SSCANF FORMAT IS BROKEN !", playerid); // ERROR msg ~ Check to repary
				Kick(playerid);
				return 1;
			}
			return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, LOGIN_DIALOG_CAPTION, LOGIN_DIALOG_INFO, "Login", "Cancel");
		}
		return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, LOGIN_DIALOG_CAPTION, LOGIN_DIALOG_INFO, "Login", "Cancel");
	}
Reply


Messages In This Thread
sscanf format broken MySQL - by HighFlyer - 17.02.2012, 19:46
Re: sscanf format broken MySQL - by iTorran - 17.02.2012, 22:49
Re: sscanf format broken MySQL - by HighFlyer - 17.02.2012, 22:50
Re: sscanf format broken MySQL - by iTorran - 17.02.2012, 22:52
Re: sscanf format broken MySQL - by HighFlyer - 17.02.2012, 22:57
Re: sscanf format broken MySQL - by HighFlyer - 17.02.2012, 23:03
Re: sscanf format broken MySQL - by iTorran - 17.02.2012, 23:08
Re: sscanf format broken MySQL - by HighFlyer - 17.02.2012, 23:15
Re: sscanf format broken MySQL - by gamer931215 - 19.02.2012, 12:06

Forum Jump:


Users browsing this thread: 2 Guest(s)