Created
January 27, 2011 02:43
-
-
Save deltreey/797970 to your computer and use it in GitHub Desktop.
This mod goes in your phpbb forums directory/includes/ucp/ucp_register.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add before the line: | |
$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>'); | |
the mod: | |
//Suicidolt's SPAM BLOCKER | |
$userCheck = file_get_contents("http://www.stopforumspam.com/api?ip=" . $user_row['user_ip'] . "&email=" . $user_row['user_email'] . "&username=" . $user_row['username']); | |
//gather output on user from stopforumspam | |
if ($userCheck) | |
{ | |
$patt = '@<(([^>\s]+)[^>]*)>(.+)<\/\2>@'; //regex | |
preg_match_all($patt, $userCheck, $match, PREG_SET_ORDER); | |
//divide up output from stopforumspam, it's xml | |
$ip_spam = false; //initialize variables as false, not a spammer yet | |
$email_spam = false; | |
$user_spam = false; | |
$i = 1; | |
foreach($match as $key => $value) | |
{ | |
if ($i == 1 && $key == 1 && $value[3] == "yes") | |
{ //ip matched, spammer | |
$ip_spam = true; | |
$i++; | |
} | |
else if ($i == 2 && $value[1] == "appears" && $value[3] == "yes") | |
{ //email matched, spammer | |
$email_spam = true; | |
$i++; | |
} | |
else if ($i == 3 && $value[1] == "appears" && $value[3] == "yes") | |
{ //username matched, spammer`` | |
$user_spam = true; | |
$i++; | |
} | |
else if ($i == 1 && $value[1] == "appears") | |
{ | |
$i++; | |
} | |
else if ($i == 2 && $value[1] == "appears") | |
{ | |
$i++; | |
} | |
else if ($i == 3 && $value[1] == "appears") | |
{ | |
$i++; | |
} | |
} | |
/*$emailsplit = explode('.', $user_row['user_email']); | |
if ($emailsplit[sizeof($emailsplit) - 1] == 'cn') //block chinese emails | |
{ | |
$email_spam = true; | |
} | |
elseif ($emailsplit[sizeof($emailsplit)- 1] == 'ru') //block russian emails | |
{ | |
$email_spam = true; | |
}*/ | |
/*$emailsplit = explode('@', $user_row['user_email']); | |
if (strrpos($emailsplit[1], ".") != stripos($emailsplit[1], ".")) | |
{ //block emails with more than 1 . after the @ | |
$email_spam = true; | |
}*/ | |
if ($ip_spam || $email_spam || $user_spam) //if anything matched | |
{ | |
//include($phpbb_root_path . 'includes/functions_user.' . $phpEx); | |
//make sure we have access to ban and delete | |
user_ban('ip',$user_row['user_ip'], 0, "", false, "Spammer"); //ban user by ip | |
user_delete('remove', $user_id); //delete user, removing all posts | |
//$userCheck = file_get_contents('http://www.stopforumspam.com/add.php?username=' . | |
// urlencode($user_row['username']) . '&ip_addr=' . $user_row['user_ip'] . | |
// '&email=' . urlencode($user_row['user_email']) . '&api_key='); | |
//submit the username, email, and ip to stopforumspam | |
//if you have an api key, uncomment that call and put in your api key | |
} | |
} | |
else | |
{ | |
user_delete('remove', $user_id); | |
trigger_error('Could not check user. Please register again.', E_USER_WARNING); | |
} | |
//End SPAM BLOCKER | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does it mean i need to open /includes/ucp/ucp_register.php
and before line:
$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
i need to paste code that you mention after your line 5 "the mod:" ? And then i remove last line of the code i pasted ( ?> ) ?
i got allow_url_fopen disabled warning on registration page after adding this code, i think it can be solved by adding
[PATH=/home/userhere/public_html]
allow_url_fopen=on
to the bottom of the global/server php.ini file
I further commented out line: user_ban('ip',$user_row['user_ip'], 0, "", false, "Spammer");
being afraid my ban ip list will grow too much