[CODE] Integrating the spam filter into Phorum

Need help with fSpamList? Post here! (DO NOT post removal requests here)

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 Phorum

Postby MysteryFCM » Sun Aug 02, 2009 6:15 am

I've just came across this one, and thought I'd post information on how to integrate the Spambot Search Tool into it. Note: This is based on the v5.2.12a.

Open: register.php

Find: (approx line #107)

Code: Select all

    // Check if the username and email address don't already exist.
    elseif(phorum_api_user_search("username", $_POST["username"])) {
        $error = $PHORUM["DATA"]["LANG"]["ErrRegisterdName"];
    } elseif (phorum_api_user_search("email", $_POST["email"])){
        $error = $PHORUM["DATA"]["LANG"]["ErrRegisterdEmail"];
    }


Add AFTER

Code: Select all

   /// BEGIN SPAM MOD
   $email = $_POST['email'];
   $ip = $_SERVER['REMOTE_ADDR'];
   $username = $_POST['username'];
   $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
      $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


If you'd like to prevent spammers already in your database, from logging in (presumably to give you a chance to identify and delete them?);

Open: login.php

Find: (approx line #209)

Code: Select all

// Check if the phorum_tmp_cookie was set. If not, the user's
// browser does not support cookies.


Add BEFORE

Code: Select all

   /// BEGIN SPAM MOD
   $ip = $_SERVER['REMOTE_ADDR'];
   $username = $_POST['username'];
   $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>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
      $error = 'Your login 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


If you are hosting the SBST locally, then change;

http://temerc.com/Check_Spammers/check_ ... _plain.php

to;

http://YOUR_DOMAIN/PATH_TO_CHECK_SPAMME ... _plain.php
Regards

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

Keeping it FREE!

Return to “Help and Support”

Who is online

Users browsing this forum: No registered users and 1 guest