The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Spam filter solution - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5)
+--- Thread: Spam filter solution (/showthread.php?tid=2223)



Spam filter solution - aurelien64 - Oct 9th, 2012

Hi,

I've been using stopforumspam.com to block automatically spams, without having to use captchas.

It's just a hook that checks if the submitted ip or email address (which is required in all our forms) has already been black listed.

It is not perfect but has been quite efficient, used on top of the honey pot method.

Here is the code I use in the Hook Manager, under the "ft_process_form, start" Code Hook:

PHP Code:
$spam=0;
$max_frequency 3;

  
$email $_POST['email'];
  
$ip $_SERVER['REMOTE_ADDR'];
  
// Check EMAIL on stopforumspam.com
if(isset($_POST['email'])){
  
$spam_xml = @file_get_contents("http://www.stopforumspam.com/api?email=$email");

  
$appears  value_in('appears'$spam_xml);
  
$frequency  value_in('frequency'$spam_xml);

  if(
$appears=="yes" and $frequency>$max_frequency){
    
$spam=1;
  }
}
// Check IP on stopforumspam.com
if(! $spam and isset($_POST['email'])){
  
$spam_xml = @file_get_contents("http://www.stopforumspam.com/api?ip=$ip");

  
$appears  value_in('appears'$spam_xml);
  
$frequency  value_in('frequency'$spam_xml);

  if(
$appears=="yes" and $frequency>$max_frequency){
    
$spam=1;
  }
}

  if($spam==1){
    $form_data["form_tools_ignore_submission"] = true;
  }

  function 
value_in($element_name$xml$content_only true) {
    if (
$xml == false) {
      return 
false;
    }
    
$found preg_match('#<'.$element_name.'(?:\s+[^>]+)?>(.*?)'.
        
'</'.$element_name.'>#s'$xml$matches);
    if (
$found != false) {
      if (
$content_only) {
        return 
$matches[1];  //ignore the enclosing tags
      
} else {
        return 
$matches[0];  //return the full pattern match
      
}
    }
    
// No match found: return false.
    
return false;
  } 

Feedback is welcome.
I'd love to see it integrated in a spam module Smile