Topic: Antispam registration mod for phpBB (for my education)
How it works....
Using email activation...
When a user registers via the forum registration page, they fill in their details and click submit.
Their IP address is cross referenced against the stop forum spam website using the API call.
If it returns a yes answer then they are sent an alternative email saying their activation has been placed on hold pending an adminstrator activation. The admin is also sent an email warning and and activation link for the account.
antispam.php goes in root folder of forum.
<?php
function checkspam($ipadd,$activate) {
/* Spam Check system from stopforumspam.com */
$url = "http://www.stopforumspam.com/api?ip=" . $ipadd;
$data = @file_get_contents($url);
$spamcheck = strpos($data, "<appears>yes");
if ($spamcheck == "0") {
$sendto = "admin@yourforum.com"; //enter your email address here
$subject = "Suspect Spammer";
$header = "From: dontreply@yourforum.com\r\n";
$header .= "Content-type: text/html\r\n";
$comment = "Please investigate suspected spammer $ipadd";
$body = "<html><body><font size=" . '"2 "' . "face=" . '"arial"' . "><h3>forum name here</h3><h4>Suspected Spammer</h4><p><b>Message: </b></p><p> " . $comment . "</p><p>However, if you are satisfied it is a geniune user, you may activate their acccount by clicking here:</p><p><a href='$activate'>Activate Account</a></p></font></body></html>";
mail($sendto, $subject, $body, $header);
}
}
function allowspam($ipadd) {
/* Spam Check system from stopforumspam.com */
$url = "http://www.stopforumspam.com/api?ip=" . $ipadd;
$data = @file_get_contents($url);
$spamcheck = strpos($data, "<appears>yes");
if ($spamcheck == "0") {return "no";} else {return "yes";}
}
function sendreject($email) {
$subject = "subject details here.";
$header = "From: dontreply@yourforum.com\r\n";
$header .= "Content-type: text/html\r\n";
$body = "<html><body><font size=" . '"2 "' . "face=" . '"arial"' . "><h3>Forum name here...</h3><h4>Activation on hold</h4><p><b>Message: </b></p><p>Your account has been placed on hold due to our stringent antispamming filtering. We apologise if this is not case.</p><p>thanks, the management</p></font></body></html>";
mail($email, $subject, $body, $header);
}
?>then the modifications to ucp_register.php in /includes/ucp/
find...
$messenger->send(NOTIFY_EMAIL);replace with
// Anti spam module ===========================================
// antispam module
include($phpbb_root_path . 'antispam.' . $phpEx);
$check45 = allowspam($user->ip);
if ($check45 == "yes") { sendreject($data['email']); } else { $messenger->send(NOTIFY_EMAIL); }
// Anti spam module =====================================find...
$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');add before
checkspam($user->ip,"$server_url/ucp.