Jump to content
  • 0

Command ban by IP


MORTE

Question

Does anyone know how I can make a new table over a command to ban an IP address can not access to play with IP banned? I just need the function block IP in IP table type places there and can not login with it because I can do command, if anyone can help me I appreciate.

Link to comment

7 answers to this question

Recommended Posts

  • 1

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
  • 1

 

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
  • 0

 

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • 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.