= get_settings('comment_max_links') ) $strike += 1; //Strike: If there is a Spam Words Match, you have two strikes $words = explode("\n", get_settings('moderation_keys') ); foreach ($words as $word) { $word = trim($word); $pattern = "#$word#i"; if ( preg_match($pattern, $author) ) $strike += 1; if ( preg_match($pattern, $email) ) $strike += 1; if ( preg_match($pattern, $url) ) $strike += 1; if ( preg_match($pattern, $comment) ) $strike += 1; if ( preg_match($pattern, $user_ip) ) $strike += 1; if ( preg_match($pattern, $author_encoded) ) $strike += 1; if ( preg_match($pattern, $email_encoded) ) $strike += 1; if ( preg_match($pattern, $url_encoded) ) $strike += 1; if ( preg_match($pattern, $comment_encoded) ) $strike += 1; } //This code is from Dougal's Spam Tar Pit // If using moderation_keys, get the IPs and add them to the list $modkeys = get_settings( 'moderation_keys' ); // Got this monster regexp from http://www.regular-expressions.info/examples.html $ip_regex = '/^\s*(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\s*$/m'; $mcount = preg_match_all( $ip_regex, $modkeys, $match_ips ); $matches = $match_ips[0]; if ( count( $matches ) > 0 ) { // Add IP numbers found foreach ( $matches as $ip ) { $ip = trim($ip); $spammer_ips[] = "/^$ip$/"; } } // Strike: Match current visitor IP against banned addresses, every match is a major "strike" if ( is_array( $spammer_ips ) ) { foreach ($spammer_ips as $ip) { if ( preg_match( $ip, $_SERVER['REMOTE_ADDR'] ) ) { $strike += 5; } } } //Strike: If there is no referer for the posted comment, that is, it did not come from the blog, another strike if ('' == $_SERVER['HTTP_REFERER']) { $strike += 1; } //This is where the strikes are processed. if ($strike >= $SpamThreshold) { // Send an email if ($send_email) { tarpit_mail(); } // Too many strikes. Into the pit! sleep( $tarpit ); @header('Status: 403 forbidden',403); @header('Content-type: text/plain'); echo <<\r\n"; // send the message @mail($recipient, $subj, $msg, $headers); } ?>