Jump to content

Command ban by IP


Recommended Posts

Open input_auth.cpp and find those strings:

	if (false == FN_IS_VALID_LOGIN_STRING(login))
	{
		sys_log(0, "InputAuth::Login : IS_NOT_VALID_LOGIN_STRING(%s) desc %p",
				login, get_pointer(d));
		LoginFailure(d, "NOID");
		return;
	}

under that add this:

	char query[1024];
	snprintf(query, sizeof(query),"SELECT ip FROM player.ban_ip WHERE ip = '%s'", inet_ntoa(d->GetAddr().sin_addr));
	std::auto_ptr<SQLMsg> execquery(DBManager::instance().DirectQuery(query));
	
	if (execquery->Get()->uiNumRows >= 1)
	{
		LoginFailure(d, "BAN_IP");
		return;		
	}

I didn't test it but it should work

 

You just need to create a table in player called ban_ip and add one field called ip with text type

 

Edit: Open intrologin.py and find this:

self.loginFailureMsgDict={

and add this:

			"BAN_IP"	: "You have an ip ban",
  • Love 2
Link to comment
Share on other sites

 

Open input_auth.cpp and find those strings:

	if (false == FN_IS_VALID_LOGIN_STRING(login))
	{
		sys_log(0, "InputAuth::Login : IS_NOT_VALID_LOGIN_STRING(%s) desc %p",
				login, get_pointer(d));
		LoginFailure(d, "NOID");
		return;
	}

under that add this:

	char query[1024];
	snprintf(query, sizeof(query),"SELECT ip FROM player.ban_ip WHERE ip = '%s'", d->GetAddr().sin_addr);
	std::auto_ptr<SQLMsg> execquery(DBManager::instance().DirectQuery(query));
	
	if (execquery->Get()->uiNumRows >= 1)
	{
		LoginFailure(d, "BAN_IP");
		return;		
	}

I didn't test it but it should work

 

You just need to create a table in player called ban_ip and add one field called ip with text type

 

Edit: Open intrologin.py and find this:

self.loginFailureMsgDict={

and add this:

			"BAN_IP"	: "You have an ip ban",

 

thanks

only takes me a question that I have to create player.ban_ip ?? because i did not muitom this function.;

Link to comment
Share on other sites

 

Open input_auth.cpp and find those strings:

	if (false == FN_IS_VALID_LOGIN_STRING(login))
	{
		sys_log(0, "InputAuth::Login : IS_NOT_VALID_LOGIN_STRING(%s) desc %p",
				login, get_pointer(d));
		LoginFailure(d, "NOID");
		return;
	}

under that add this:

	char query[1024];
	snprintf(query, sizeof(query),"SELECT ip FROM player.ban_ip WHERE ip = '%s'", d->GetAddr().sin_addr);
	std::auto_ptr<SQLMsg> execquery(DBManager::instance().DirectQuery(query));
	
	if (execquery->Get()->uiNumRows >= 1)
	{
		LoginFailure(d, "BAN_IP");
		return;		
	}

I didn't test it but it should work

 

You just need to create a table in player called ban_ip and add one field called ip with text type

 

Edit: Open intrologin.py and find this:

self.loginFailureMsgDict={

and add this:

			"BAN_IP"	: "You have an ip ban",

 

You have little mistake in the code, should be:

	char query[1024];
	snprintf(query, sizeof(query),"SELECT ip FROM player.ban_ip WHERE ip = '%s'", inet_ntoa(d->GetAddr().sin_addr));
	std::auto_ptr<SQLMsg> execquery(DBManager::instance().DirectQuery(query));
	
	if (execquery->Get()->uiNumRows >= 1)
	{
		LoginFailure(d, "BAN_IP");
		return;		
	}

PS. It's work

  • Love 2
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.