Jump to content

IP.Board Style© Fisana
 

User is offline Author

Find Posts Tutorial info

  • Added on: Mar 26 2011 12:45 AM
  • Views: 8454

Collaboration

Spamer IP/Email Check on Registration

* * * * *

Description: IPB 2.3.x version of: IPB3 Forum Spammer IP Check hook
Adds a check during registration submission that checks the registers IP address and email address against a known list of spammer IP's and emails from stopforumspam.com. If it returns true for a spamming IP or email the registration is rejected. The IP of the offender is added to your Ban Filters.

Note: You must be using php5 because of the simplexml_load_file() function. This edit is to stop known human spammers. Please use your CAPTCHA and a security question for bots.

We are placing it just past the point where CAPTCHA is validated. This way you won't get tons of bots clogging your ban filters when they can't get past CAPTCHA to begin with.

Open /sources/action_public/register.php

Search for:
if ( $captchaClass->validate() !== TRUE )
			{
				$form_errors['general'][$this->ipsclass->lang['err_reg_code']] = $this->ipsclass->lang['err_reg_code'];
			}
		}

Add after:
//-----------------------------------------
		// Stop Forum Spam Check © Coding Lair Mods
		//-----------------------------------------

		$ipcheck = simplexml_load_file('http://www.stopforumspam.com/api?ip='. $this->ipsclass->ip_address);
		$emailcheck = simplexml_load_file('http://www.stopforumspam.com/api?email='. $this->ipsclass->input['EmailAddress']);
		
		if ($ipcheck->appears == 'yes') {
			$this->ipsclass->DB->do_insert('banfilters', array('ban_type' => 'ip',
															  'ban_content' => $this->ipsclass->ip_address,
															  'ban_date' => time()
															  ));
															
			require_once ROOT_PATH.'sources/classes/bbcode/class_bbcode_core.php';
		
			$this->ipsclass->cache['banfilters'] = array();
			
			$this->ipsclass->DB->simple_construct( array( 'select' => 'ban_content', 'from' => 'banfilters', 'where' => "ban_type='ip'" ) );
			$this->ipsclass->DB->simple_exec();
	
			while ( $r = $this->ipsclass->DB->fetch_row() ){
				$this->ipsclass->cache['banfilters'][] = $r['ban_content'];
			}
		
			usort( $this->ipsclass->cache['banfilters'] , array( 'class_bbcode_core', 'word_length_sort' ) );
		
			$this->ipsclass->update_cache( array( 'name' => 'banfilters', 'array' => 1, 'deletefirst' => 1 ) );
															  
			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'ss_error' ) );
		}
		
		if ($emailcheck->appears == 'yes') {
						$this->ipsclass->DB->do_insert('banfilters', array('ban_type' => 'email',
															  'ban_content' => $this->ipsclass->input['EmailAddress'],
															  'ban_date' => time()
															  ));
															
			require_once ROOT_PATH.'sources/classes/bbcode/class_bbcode_core.php';
		
			$this->ipsclass->cache['banfilters'] = array();
			
			$this->ipsclass->DB->simple_construct( array( 'select' => 'ban_content', 'from' => 'banfilters', 'where' => "ban_type='email'" ) );
			$this->ipsclass->DB->simple_exec();
	
			while ( $r = $this->ipsclass->DB->fetch_row() ){
				$this->ipsclass->cache['banfilters'][] = $r['ban_content'];
			}
		
			usort( $this->ipsclass->cache['banfilters'] , array( 'class_bbcode_core', 'word_length_sort' ) );
		
			$this->ipsclass->update_cache( array( 'name' => 'banfilters', 'array' => 1, 'deletefirst' => 1 ) );
															  
			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'ss_error' ) );
		}

Save register.php back to your server.

Open /cache/lang_cache/en/lang_register.php

At the top after:
$lang = array (

Add below:
'ss_error'      => "Your information is listed as known a spammer and you are not welcome here.",

Save lang_register.php back to your server.

That is it. Check your Ban Filters occasionally to see what you have caught.

-Coding Lair Mods


Powered by Tutorials 1.3.0 © 2019, by Michael McCune
Copyright © 2019 Your Company Name