Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#26 2011-12-12 16:34:32

trichome
Member
Registered: 2008-05-22
Posts: 42

Re: [MOD] Spam IP Check (stopforumspam.com, spamhaus.org, etc.)

Thank you so much!

I can understand not wanting to rely on third party services for anything in the core but if I had to pick 3 mods to be officially maintained they would be the bad behavior mod, this mod, and the recaptcha mod. The bad behavior mod alone blocks from 7-10K access requests a week for me.

Sorry to go off topic here, but the ability to keep a forum free of spam and the work associated with it means A LOT, and those who make that possible deserve a big thank you!

Last edited by trichome (2011-12-12 16:35:26)

Offline

#27 2011-12-15 01:05:21

trichome
Member
Registered: 2008-05-22
Posts: 42

Re: [MOD] Spam IP Check (stopforumspam.com, spamhaus.org, etc.)

I'm still getting ~10 spammers per day that are already listed on stopforumspam. Many of them have been listed for months so I'm assuming it's not just a synch issue with dnsbl.tornevall.org.

I made the change Smartys pointed out with the double equals sign, other than that everything is set up per the readme. Any ideas on what could be going wrong? Spammers are such a pain. sad

Offline

#28 2011-12-15 04:41:42

Smartys
Former Developer
Registered: 2008-04-27
Posts: 3,139
Website

Re: [MOD] Spam IP Check (stopforumspam.com, spamhaus.org, etc.)

There are so many things wrong with this modification.

if ($pun_config['o_ipcheck_enable'] == 1 && empty($_POST['form_sent']))

This piece of code is wrong. It *should* be checking when a POST request is being sent.

The block of code in register.php is also in entirely the wrong place. It should go right before the line that says

// Did everything go according to plan?

----

In summary, where the README says

#
#---------[ 4. OPEN ]---------------------------------------------------------
#

register.php

#
#---------[ 5. FIND (line: 60) ]---------------------------------------------
#

	require PUN_ROOT.'footer.php';
}

#
#---------[ 6. AFTER, ADD ]---------------------------------------------------
#

//--------------Start Spam IP Check--------------
if ($pun_config['o_ipcheck_enable'] == 1 && empty($_POST['form_sent']))
{
	$ip = get_remote_address();
	$timestamp = time();
// etc

it should actually say

#
#---------[ 4. OPEN ]---------------------------------------------------------
#

register.php

#
#---------[ 5. FIND (line: 60) ]---------------------------------------------
#

// Did everything go according to plan?

#
#---------[ 6. BEFORE, ADD ]---------------------------------------------------
#

//--------------Start Spam IP Check--------------
if ($pun_config['o_ipcheck_enable'] == 1)
{
	$ip = get_remote_address();
	$timestamp = time();

Note: I do not guarantee that I found all of the issues in this modification.

Last edited by Smartys (2011-12-15 04:42:10)

Offline

#29 2011-12-15 14:11:19

trichome
Member
Registered: 2008-05-22
Posts: 42

Re: [MOD] Spam IP Check (stopforumspam.com, spamhaus.org, etc.)

Well I made the changes you so kindly summarized last night and this morning only 1 listed spammer had registered, down from ~10!

I understand that it can be very unpleasant to pick up someone else's code so your help here is very much appreciated. Thank you!

Last edited by trichome (2011-12-15 14:11:31)

Offline

#30 2011-12-15 21:59:44

Smartys
Former Developer
Registered: 2008-04-27
Posts: 3,139
Website

Re: [MOD] Spam IP Check (stopforumspam.com, spamhaus.org, etc.)

Oh, no worries: I'm happy to help smile

Offline

#31 2012-02-29 12:31:23

Jack
Member
Registered: 2010-12-24
Posts: 485
Website

Re: [MOD] Spam IP Check (stopforumspam.com, spamhaus.org, etc.)

I'm having some problem with this (great) plugin. It is blocking lots of "clean" IP (even my IP!)... any clue?

J


Sorry I don't speak English smile
FluxBB Italy

Offline

#32 2012-03-11 15:26:27

den4b
Member
From: Dublin, Ireland
Registered: 2010-08-14
Posts: 24
Website

Re: [MOD] Spam IP Check (stopforumspam.com, spamhaus.org, etc.)

To summarize, there are major issues with this mod which can be easily fixed:

  1. Fix $pass equal sign.

  2. Correct plugin code placement and form_sent checking.

Can someone please update this mod by incorporating the outlined fixes?

The updated steps in the readme file are as follows:

#
#---------[ 4. OPEN ]---------------------------------------------------------
#

register.php

#
#---------[ 5. FIND (line: 150) ]---------------------------------------------
#

	// Did everything go according to plan?
	if (empty($errors))
	{

#
#---------[ 6. BEFORE, ADD ]---------------------------------------------------
#

//--------------Start Spam IP Check--------------
if ($pun_config['o_ipcheck_enable'] == 1)
{
	$ip = get_remote_address();
	$timestamp = time();
	$current_day = floor($timestamp/86400);
	$last_day = floor($pun_config['o_ipcheck_timestamp']/86400);
	$check = 0; // if 1 it'll do a dnsbl lookup
	$resetlimit = 0; // if not 0 it'll reset the total lookups
	
	// Prevent the same IP being checked every hour if it already failed
	if ($pun_config['o_ipcheck_lastip'] == $ip && $pun_config['o_ipcheck_pass'] == 0 && ($timestamp - 3600) < $pun_config['o_ipcheck_timestamp'])
		message($lang_register['Spam IP Failed']);
	else if ($pun_config['o_ipcheck_lastip'] != $ip || ($timestamp - 3600) > $pun_config['o_ipcheck_timestamp'])
	{
		if ($current_day == $last_day)
		{
			if ($pun_config['o_ipcheck_used'] < $pun_config['o_ipcheck_limit'])
				$check = 1;
			else if ($pun_config['o_ipcheck_overlimit_reg'] == 0)
				message($lang_register['Spam IP Overlimit']);
		}
		else
		{
			$check = 1;
			$resetlimit = 1;
		}
		if ($check == 1)
		{
			$dnsbl_lists = explode(",", preg_replace('/\s+/', '', $pun_config['o_ipcheck_dnsbl']));
			$reverse_ip = implode(".", array_reverse(explode(".", $ip)));
			$pass = 1;
			
			foreach($dnsbl_lists as $list)
			{
				if (checkdnsrr($reverse_ip.".".$list.".", "A")) 
				{
					$pass = 0;
					break; // for speedy checks just find in any list and then break
				}
			}
			
			$db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$ip.'\' WHERE conf_name=\'o_ipcheck_lastip\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
			if ($resetlimit == 0)
				$db->query('UPDATE '.$db->prefix.'config SET conf_value='.($pun_config['o_ipcheck_used']+1).' WHERE conf_name=\'o_ipcheck_used\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
			else
				$db->query('UPDATE '.$db->prefix.'config SET conf_value=0 WHERE conf_name=\'o_ipcheck_used\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
			$db->query('UPDATE '.$db->prefix.'config SET conf_value='.$pass.' WHERE conf_name=\'o_ipcheck_pass\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
			$db->query('UPDATE '.$db->prefix.'config SET conf_value='.$timestamp.' WHERE conf_name=\'o_ipcheck_timestamp\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
			
			// Regenerate the config cache
			if (!defined('FORUM_CACHE_FUNCTIONS_LOADED'))
				require PUN_ROOT.'include/cache.php';
			
			generate_config_cache();
			
			if ($pass == 0)
				message($lang_register['Spam IP Failed']);
		}
	}
}
//--------------End Spam IP Check----------------

Offline

#33 2012-03-23 19:41:04

Ulto
Member
Registered: 2012-02-19
Posts: 4

Re: [MOD] Spam IP Check (stopforumspam.com, spamhaus.org, etc.)

I want to use it, too. Is it ready now? Is there anything to do?

Offline

#34 2012-03-23 23:08:32

den4b
Member
From: Dublin, Ireland
Registered: 2010-08-14
Posts: 24
Website

Re: [MOD] Spam IP Check (stopforumspam.com, spamhaus.org, etc.)

Ulto wrote:

I want to use it, too. Is it ready now? Is there anything to do?

You must follow the updated steps listed in my previous post to fix all known issues. After that, you should be fine.

Offline

Board footer

Powered by FluxBB