[CODE] Integrating the spam filter into SMF

Mods for various forums/blogs for use with the SBST

Moderator: fspamlist

User avatar
MysteryFCM
Site Admin
Site Admin
Posts: 3721
Joined: Sun May 15, 2005 12:42 pm
Location: Newcastle, UK
Contact:

[CODE] Integrating the spam filter into SMF

Postby MysteryFCM » Thu Nov 27, 2008 7:17 pm

Open /sources/register.php

Find (approx line #284);

Code: Select all

   // Include the additional options that might have been filled in.
   foreach ($possible_strings as $var)


Add BEFORE;

Code: Select all

   /// BEGIN SPAM MOD
   $username = $_POST['user'];
   $emailaddr = $_POST['email'];
   $ip = $_SERVER['REMOTE_ADDR'];
   // Either use the existing URL, or download a copy of the check_spammers.zip file to your server and use that instead.
   //
   // http://temerc.com/forums/viewtopic.php?f=71&t=6103
   //
   $fspamcheck = file_get_contents('http://temerc.com/Check_Spammers/check_spammers_plain.php?name='.$username.'&email='.$emailaddr.'&ip='.$ip);
   if (strpos($fspamcheck, 'TRUE') !==False) {
      // Notify admin via e-mail
      $blockedby = str_replace(' TRUE', '', $fspamcheck);
      $blockedby = str_replace(' ', ' & ', $blockedby);
      $msg = 'The following was blocked by the '.$blockedby.' filter<br><br>Username: '.$username.'<br><br>Email: '.$emailaddr.'<br><br>IP: '.$ip;
      // Change your@email.addr to the e-mail address you want e-mail reports sent to
      $to = "your@email.addr";
      $from = "nobody@".$_SERVER['SERVER_NAME'];
      $subject = "Spammer blocked by hpHosts Spam filter";
      $headers =    "MIME-Versin: 1.0\r\n" .
      "Content-type: text/html; charset=ISO-8859-1; format=flowed\r\n" .
      "Content-Transfer-Encoding: 8bit\r\n" .
      "From: " . $from . "\r\n" .
      "X-Mailer: hpHosts Spam Filter";
      mail($to, $subject, $msg, $headers);
      // Notify user
      fatal_lang_error(1);
      // You could always redirect them to a custom error if you prefer, by commenting out the above, and uncommenting the following.
      // redirectexit('banned.html');
   }
   /// END SPAM MOD



If you are hosting the check_spammers function locally, then change;

http://temerc.com/Check_Spammers/check_spammers_plain.php

to;

http://YOUR_DOMAIN/PATH_TO_CHECK_SPAMMERS/check_spammers_plain.php
Last edited by MysteryFCM on Thu May 14, 2009 2:10 pm, edited 1 time in total.
Reason: Cleaned up mod code
Regards

Steven Burn
I.T. Mate / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!

User avatar
mikey
Countermeasures Team
Countermeasures Team
Posts: 48
Joined: Fri Mar 11, 2005 7:48 am
PC time: What else is there in life?
Location: CenTex USA
Contact:

Re: [CODE] Integrating the spam filter into SMF

Postby mikey » Sat Jun 26, 2010 9:03 pm

Thx, MFCM. I'm now using the StopForumSpam.com API from this mod; http://custom.simplemachines.org/mods/i ... p?mod=1547 I really like the way it automatically puts the user in the 'awaiting approval' category instead of sending the welcome email.

But your method not only checks multiple DBs, it also redirects them to an explanation page that I can add a 'contact us' script on in case they feel the block and eventual ban is in error. I'm going to try it out using the 'check_spammers' install. I'm eager to put it to work. Thx again.

BTW Just looking at it, I don't see any reason it wouldn't work in the SMF2.0RC3 that I'm using. Have you by any chance looked at the newer SMF versions?

User avatar
MysteryFCM
Site Admin
Site Admin
Posts: 3721
Joined: Sun May 15, 2005 12:42 pm
Location: Newcastle, UK
Contact:

Re: [CODE] Integrating the spam filter into SMF

Postby MysteryFCM » Sat Jun 26, 2010 9:09 pm

Nice one!, thanks for letting me know :)

I've not had time to look at the new SMF releases unfortunately :( (completely swamped with work, hpHosts and family etc)
Regards

Steven Burn
I.T. Mate / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!

User avatar
mikey
Countermeasures Team
Countermeasures Team
Posts: 48
Joined: Fri Mar 11, 2005 7:48 am
PC time: What else is there in life?
Location: CenTex USA
Contact:

Re: [CODE] Integrating the spam filter into SMF

Postby mikey » Sat Jun 26, 2010 9:17 pm

That's cool, I know all too well how life gets in the way of living. :)

I'll let you know how it goes. Thx again for all the efforts you manage.

User avatar
MysteryFCM
Site Admin
Site Admin
Posts: 3721
Joined: Sun May 15, 2005 12:42 pm
Location: Newcastle, UK
Contact:

Re: [CODE] Integrating the spam filter into SMF

Postby MysteryFCM » Sat Jun 26, 2010 9:39 pm

My pleasure, and thank you :)
Regards

Steven Burn
I.T. Mate / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!


Return to “Mods”

Who is online

Users browsing this forum: No registered users and 1 guest