[CODE] Integrating the spam filter into SMF v2.0

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

Postby MysteryFCM » Thu Sep 13, 2012 2:35 pm

Open /sources/register.php

Find (approx line #363);

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";
      // Important: If you do NOT want email notifications, add // to the beginning of the following line.
      mail($to, $subject, $msg, $headers);
      // Notify user
      fatal_lang_error('known_spammer_blocked');
      // 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


Open /Themes/default/languages/index.english.php

Find;

Code: Select all

$txt['debug_hide_queries'] = '[Hide Queries]';


Add AFTER;

Code: Select all

$txt['known_spammer_blocked'] = 'Spam registration blocked';


If you are hosting the SBST locally, then change;

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

to;

http://YOUR_DOMAIN/PATH_TO_CHECK_SPAMMERS/check_spammers_plain.php
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