Jump to content

How to stop spam bots


reportingsjr

Recommended Posts

I noticed that the spam has stopped for now, but I will post this anyways.http://www.tfbw.com/archives/20I was told that that will stop spam bots because they dont set the cookie and looks reasonable. So if the mods can do this please do! Or I guess maybe Kaijim might do it...Just thought I would help to forum :).

Link to comment
Share on other sites

I stopped bots on my IPB. Through a series of simple PHP mods they stopped altogether. Not 1 single bot in 4 weeks (since creation of system).Basically the bots on my IPB were posting with the following:- Smily face like this :) as post icon- Less than 5 days on forums- Less than 5 posts- URLs or IMGs of more than 3So i basically made a few IF statements in the IPB class_post.php file and made it redirect if the IF statement was true to a 'YOU CANT POST, YOUR A BOT!' page. I also slightly modified the IPB Captcha registration image.If you want a copy of the code just drop me a PM. It worked in my IPB v2.0.1.I hate bots >_>

Link to comment
Share on other sites

Well, what if the person is just asking for help on a program and they have a few pictures, and they wanted quick help so they registered and posted? What then?

Link to comment
Share on other sites

Well thats why I made it flexible. If the system was around 40% sure they were a bot it would make the post 'unaproved' and awits moderator approval.Also I think it would be highly unlikely that a user, by chnace, gets suspected as a bot....just look at the posts on here :)Well thats how I fixed it...there may be a more effective way but I dont know of it.

Link to comment
Share on other sites

Open up sources/classes/post/class_post.php and add this to the end of the function named compile_post()

//-----------------------------------------		// Check if they are a bot [XENON DESIGN]		//-----------------------------------------		include_once(ROOT_PATH."sources/action_public/xemod_userinfo.php");		$xemods = new xemod_userinfo();		$xemods->init_db_conn();		$user_id = $this->ipsclass->member['id'];		$user_info = $xemods->get_full_user_info($user_id);		$num_img = substr_count($this->ipsclass->input['Post'], '[IMG');		$num_img += substr_count($this->ipsclass->input['Post'], '[img');		$num_url = substr_count($this->ipsclass->input['Post'], '[URL');		$num_url += substr_count($this->ipsclass->input['Post'], '[url');		$num_posts = $user_info['posts'];		$days_joined = floor((time() - $user_info['joined'])/( 24 * 60 * 60));		if($days_joined < 5 && $num_posts < 5 && $this->ipsclass->input['iconid'] == 1){			if($num_img >= 3 || $num_url >=3){				$this->ipsclass->Error( array( LEVEL => 1, MSG => 'bot_detected') );			}			$post['queued'] = 1;			$this->obj['post_errors'] = $this->parser->error;			return $post;		}

Add that just before this:

$this->obj['post_errors'] = $this->parser->error;			return $post;

Youll have to add my special 'xemod_userinfo.php' into your sources/action_public folder. Heres the code for it. Just make the file with the below:

<?phpif ( ! defined( 'IN_IPB' ) ){	print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";	exit();}class xemod_userinfo{	#Globals	var $conn;		function init_db_conn(){		global $global_xemod, $conn;		if($global_xemod['conn_status'] == false){			$conn = mysql_connect('localhost', '%mysqlUSERNAME%', '%mysqlPASSWORD%');			if(!$conn){				die('CONNECION ERROR - Xenon Mod failure');			}else{				mysql_select_db("%databaseNAME%", $conn);				$global_xemod['conn_status'] = true;			}		}	}	function get_full_user_info($user_id){		global $conn;		$user_id = ereg_replace("[^0-9]", "", $user_id);		$sql_1 = "SELECT * FROM %IPB-DB-PREFIX%members WHERE id = ".$user_id;		$query_1 = mysql_query($sql_1, $conn);		if(!$query_1 || mysql_num_rows($query_1) < 1){			return "error";		}		return mysql_fetch_array($query_1);	}}?>

That file does include more 'stuff' in it and if you go to http://martin2k.co.uk/forums and view a post you'll see a few mods I have made. You could just get the user info from the IPB but I just decided to use what I had already made previously.Then just for a small bug fix in my code, open up sources/ipsclass.php and add this in the function named Error (case specific):

if($error['MSG'] == 'bot_detected'){			$msg = "Your post has been suspected as being a SPAM post and has not been submitted! Your username has been added to our watch list along with your IP.";		}

Put it after the following line of code:

$msg = $this->lang[ $error['MSG'] ];

-~-~-~Now for a lowdown on what happens:When a user posts that is less than 5 days old, less than 5 posts, uses simily icon 1 then their post is then put under moderation/unapproved status. If there is then more than 3 url's and/or 3 or more img's then they cannot post that topic.It works in my IPB 2.0.1. Hopefully it will work for you :) If not drop me a PM.

Link to comment
Share on other sites

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