saving ip in mysql database
#1


Hello, I've been having a very irritating problem for a few days now.

I'm using the incognito mysql plugin to store IP addresses in a database (together with username, etc).
It works perfectly to store the username, reason etc into the database, but the IP address is not giving the right result.

I have two files, a filterscript and an .inc file.

Filterscript:

Код:
	  		new
		         PIP[16],
	  	         giveid,
 		 		hour,
	  		 	minute,
		  	     second,
		  	     year,
	  		 	month,
		  		day;
	  		
		     GetPlayerIp(giveid, PIP, sizeof(PIP));

			gettime(hour, minute, second);
			getdate(year, month, day);

	         gSQL_BanUser(PlayerName(giveid), PlayerName(playerid), params[idx], PIP, hour, minute, second, day, month, year);
Include

Код:
stock gSQL_BanUser(nickname[], Admin[], Reason[], IP[], hour, minute, second, day, month, year)
{
     new
		sTmp[256],
         sqlcmd[256+128];
	strcat(sqlcmd, "INSERT INTO `" #MYSQL_DB "`.`" #MYSQL_BAN_TABLE "` (",sizeof(sqlcmd));
	strcat(sqlcmd,"`Name` ,`Admin`,`Reason`,`IP`,`TIME`,`DATE`)",sizeof(sqlcmd));
 	format(sTmp, sizeof(sTmp), "INSERT INTO Banlijst(Name, Admin, Reason,IP,Time,Date) VALUES ('%s' , '%s', '%s', '%s', '%d:%d:%d', '%d.%d.%d')", nickname, Admin, Reason,IP, hour, minute, second, day, month, year);
	strcat(sqlcmd, sTmp,sizeof(sqlcmd));
	if(samp_mysql_query(sTmp)) {
	  sTmp[0]='\0';
       format(sTmp, sizeof(sTmp), "User %s banned!", nickname);
	  Log(sTmp);
	}
	return 1;
}


The output:



I really hope someone knows how to fix this.


Reply


Messages In This Thread
saving ip in mysql database - by swredder - 12.05.2010, 18:26
Re: saving ip in mysql database - by Kyosaur - 12.05.2010, 18:39
Re: saving ip in mysql database - by swredder - 12.05.2010, 18:42

Forum Jump:


Users browsing this thread: 1 Guest(s)