Jump to content

IP.Board Style© Fisana
 

User is offline Author

Find Posts Tutorial info

  • Added on: Mar 26 2011 12:48 AM
  • Views: 10473

Collaboration

Add Forum Spamer IP check to login

* * * * * 1 Ratings

Description: Add a stopforumspam.com IP check to forum log in
Note: PHP 5 is required to use this edit.

Checking my locked accounts in ACP I found many, if not most were listed in the Stop Forum Spam database. This edit should cut down the amount failed login locked acocunts due to brute force spammer attempts. It is similar the the Forum Spamer IP/Email Check for the registration page.

Open /sources/action_public/login.php.

Find:
if ( $_POST['PassWord'] == "" )
		{
			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'pass_blank' ) );
		}

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

		$ipcheck = simplexml_load_file('http://www.stopforumspam.com/api?ip='. $this->ipsclass->ip_address);
		
		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' ) );
		}

Save login.php back to your server.

Open /cache/lang_cache/en/lang_login.php

Find:
#2.2
'bruteforce_account_unlock'	=> "Your account will automatically be unlocked in %s minutes",

Add above:
// Stop Forum Spam Check
'ss_error'      => "Your IP is a known spammer IP and you are not welcome here.",

Save lang_login.php back to your server.

Now you are done. Like the check for the registration page, this edit also adds the offending IP to your Ban Filters.

-Coding Lair Mods


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