Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> How To Prevent Spam Bots In Your Forums!, How to prevent them.
Houdini
post Jan 14 2006, 12:10 AM
Post #1


Super Member
Group Icon

Group: Members
Posts: 572
Joined: 25-April 05
From: Nashville Tennessee
Member No.: 4,340



Last week I started getting some spam on my PHP-Nuke in the forums. These were obvously SPAM. Poker, casino, and prescriptions and stuff of that sort. At first I just made a couple of new forums where I placed these posts, then edited out all the links. Some of them used e-mail addresses as a poster and some merely used guest.

Then after I had placed these posts in their own new forum iwth the links removed, I did an IP BAN on eall the various IPs they were using. But that wasn't good enough for me so I found a Spam eliminator MOD on the phpBB Hacks site. I downloaded and installed it, and I have since not had any more spam posts in my forums.

The MOD is real ssimple and you only edit one file so it will be included with this post for you to copy and paste so you can prevent this sort of annoyance from happening or stopping it if you are currently getting this type of KRUD on your site. What the program does is add an auth encrypted signature and looks for a post that took more than 5 seconds after the posting area was generated other wise if a post was made within the 5 second time frame (faster than a human) it just shows a preview and not the actual post, so the bot never really posts and you don't ever see it.

Below is the code for both PHP-Nuke with phpBB forums and also the phpBB2 stand alone bulletin board. Hope this help other PHP-Nuke users like it did me!
CODE
#-----[ OPEN ]------------------------------------------
#
posting.php

#
#-----[ FIND ]------------------------------------------
#
$refresh = $preview || $poll_add || $poll_edit || $poll_delete;

#
#-----[ BEFORE, ADD ]------------------------------------------
#
switch ($mode) {
case 'newtopic':
$secretkey = 'f' . $forum_id;
break;

case 'quote':   // If we're quoting, we need to determine the topic ID
$sql = 'SELECT topic_id FROM ' . POSTS_TABLE . ' WHERE post_id=' . $post_id;
       if (!($query = $db->sql_query($sql)))
{
               message_die(GENERAL_MESSAGE, 'Could not obtain quoted topic information', '', __LINE__, __FILE__, $sql);
}

       if (($row = $db->sql_fetchrow($query)))
{
               $topic_id = $row['topic_id'];
}
       else
{
               message_die(GENERAL_MESSAGE, 'No_such_post');
}
       // Fall through to 'reply' case

case 'reply':
case 'vote':
       $secretkey = 't' . $topic_id;
       break;
case 'editpost':
       $secretkey = 'p' . $post_id;    
       break;
}

// Generate a signature to validate this page
$authkey = md5("nana" . $secretkey . "foofoo");
$authval = md5($HTTP_SERVER_VARS['HTTP_USER_AGENT'] . $secretkey . $HTTP_SERVER_VARS['REMOTE_ADDR']);  
$timekey = md5("time" . $secretkey);
$timepad = preg_replace('/[^0-9]/', '', $HTTP_SERVER_VARS['REMOTE_ADDR']) + 0;
$timeval = time() ^ $timepad;

// Check the signature - if this is a submit which doesn't jive with the above, turn it into a preview
if ($submit && (!isset($HTTP_POST_VARS[$authkey])
               || $HTTP_POST_VARS[$authkey] != $authval
               || !isset($HTTP_POST_VARS[$timekey])
               || ($HTTP_POST_VARS[$timekey] ^ $timepad) > time() - 5))
{
$submit = false;
$preview = true;
}

#
#-----[ FIND ]------------------------------------------
#
// Generate smilies listing for page output
generate_smilies('inline', PAGE_POSTING);

#
#-----[ BEFORE, ADD ]------------------------------------------
#
// Insert our signature into the form
$hidden_form_fields .= '<input type="hidden" name="' . $authkey . '" value="' . $authval . '">';
$hidden_form_fields .= '<input type="hidden" name="' . $timekey . '" value="' . $timeval . '">';

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------

Go to the top of the page
 
+Quote Post
HellFire121
post Jan 29 2006, 01:00 AM
Post #2


Premium Member
Group Icon

Group: [HOSTED]
Posts: 438
Joined: 28-January 06
Member No.: 10,925



hmm that's a good idea, when i get my hosting here i'll take a look at that
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics


 



- Lo-Fi Version Time is now: 20th November 2008 - 11:05 PM