[CODE] Integrating the spam filter into DragonFly CMS

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 DragonFly CMS

Postby MysteryFCM » Wed Apr 22, 2009 5:59 pm

Working on a site for a friend, I had a need to integrate the SBST into a DragonFly CMS site. I figured I'd post the code here for those that need it (the code is actually pretty much the same as it is for the other CMS sites/forums).

Open: modules/Your_Account/register.php

Find: (in the register_checks function, line #141)

Code: Select all

   $fields['username'] = $username;
   $fields['email'] = $email;
   $fields['password'] = $password;
   $fields['coppa'] = $_POST['coppa'];


Add AFTER:

Code: Select all

// Ensure the user isn't blacklisted
// BEGIN SPAM MOD
$ip = $_SERVER['REMOTE_ADDR'];
// Replace temerc.com/Check_Spammers, with the path on your site, to the SBST if you are hosting it yourself
$fspamcheck = file_get_contents('http://temerc.com/Check_Spammers/check_spammers_plain.php?name='.$username.'&email='.$email.'&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: '.$email.'<br><br>IP: '.$ip;
      $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
      cpg_error('Your registration has been blocked by our <a href="http://temerc.com/Check_Spammers/">spam filter</a>. Please either try again or contact an administrator');
}
// END SPAM MOD


You'll need to download the Check Spammers file, and place the files on your server.

viewtopic.php?f=71&t=6103
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