This MOD has been replaced by a better version with ACP support. You can find that version here.
What follows is commentary on the original version, which still works fine (tested up through version 2.0.21). However most users will prefer to use the ACP version because it has more options and is easier to install.
-RJ
***
This is a continuation and enhancement of a previous MOD. It has been improved by many community members and seems to be very stable. The code below has been tested with phpBB versions 2.0.6 through 2.0.20. A big thanks to the original author niekas for getting it going. Unfortunately he seems to have disappeared, so we are starting a new thread to continue development of this excellent MOD.
The purpose of this MOD is to prevent spambots from registering user accounts on your forum, using spammy URL and Signature fields. These bots do not care whether or not you have account activation enabled because the spammers only want to create a web link from your forum to their website. Bots are detected as follows:
- 1. You remove the URL/Sig fields from your new user registration template.
2. Any user submitting a URL or Sig field during registration MUST be a spambot script, because normal users won't see those fields during registration.
3. Add code to check how many posts the user has made. If it is above a certain number (default 10) then the user will be able to add a URL and/or Sig when editing his or her profile.
Again, I can't take credit for this awesome MOD. It was a community effort, and all of the contributors (to my knowledge) are listed as authors in the comments. For a more complete explanation of how this MOD changed over time, and why various design changes were made, please see the previous MOD.
-RJ
Code: Select all
##############################################################
## MOD Title: Anti-spam bots registration
## MOD Author: niekas, artesea, cyberCrank, Lord Raiden, RevJim, DJ Andre, Ramon Fincken
##
## MOD Description: prevents spam bots registering on your forum by
## removing website and signature fields in registration and profile form
## until users reached certain amount of posts and sends an email notification
## to learn IP address and more
## MOD Version: 0.0.1 (BETA)
##
## Installation Level: (Easy)
## Installation Time: ~5 minutes
## Files To Edit:
## /includes/usercp_register.php
## /templates/subSilver/profile_add_body.tpl
## Included Files: (n/a)
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/phpBB/viewtopic.php?p=2166870 for the
## latest version of this MOD BETA. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
##
## Author Notes:
## + installable with EasyMOD
## + Edit the e-mail address variable if you want to receive notification for spam bot registration attempts.
##
##############################################################
##
## MOD History:
## 2006-06-05 - Version 0.0.1
## + Misc. code cleanup to make implementation easier.
## + Version numbering changed in accordance with forum rules. For version numbering information, see: http://www.phpbb.com/phpBB/viewtopic.php?t=266307
## 2006-05-20 - Version 0.0.0
## + For all previous revisions, see http://www.phpbb.com/phpBB/viewtopic.php?t=186683
## This MOD started with a different design and has been modified to meet current phpBB MOD guidelines and EasyMOD templating.
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php
#
#-----[ FIND ]------------------------------------------
#
$error = FALSE;
#
#-----[ AFTER, ADD ]------------------------------------------
#
# NOTE - be sure to add your email address in this area (below):
#
# $myEmailAddress = "YOUR-EMAIL@YOUR-DOMAIN";
#
$cut_off=10; //how many posts should user have before form fields are activated
// ---------------------------------------
if (($mode == 'register' && ($HTTP_POST_VARS['website'] != '' || $HTTP_POST_VARS['signature'] != '') ) || ($userdata['user_posts'] < $cut_off && $mode=='editprofile' && ($HTTP_POST_VARS['website'] != '' || $HTTP_POST_VARS['signature'] != '')))
{
$myEmailAddress = "YOUR-EMAIL@YOUR-DOMAIN"; // Edit this with your proper e-mail address.
//**********
// If you DO NOT wish to receive e-mail notifications of spam bot registration attempts, delete all of the code between the lines of asterisks.
$spammerIPAddress = ( !empty($HTTP_SERVER_VARS['REMOTE_ADDR']) ) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ( ( !empty($HTTP_ENV_VARS['REMOTE_ADDR']) ) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv('REMOTE_ADDR') );
$spammerUsername = $HTTP_POST_VARS['username'];
$spammerEmailAddress = $HTTP_POST_VARS['email'];
$spammerWebsite = $HTTP_POST_VARS['website'];
$spammerSignature = $HTTP_POST_VARS['signature'];
$spammerPassword = $HTTP_POST_VARS['new_password'];
$emailSubject = "Notification of Spam Bot Attempt";
$emailHeader = "From: Spam-Bot-Mod";
$emailMessage = "Spam Bot Registration Attempted.\n\n";
$emailMessage .= "Spammer's IP Address = " . $spammerIPAddress . "\n";
$emailMessage .= "IP Lookup = http://www.nwtools.com/default.asp?prog=express&host=" . $spammerIPAddress . "\n";
$emailMessage .= "Spammer's Username = " . $spammerUsername . "\n";
$emailMessage .= "Spammer's Password = " . $spammerPassword . "\n";
$emailMessage .= "Spammer's email address = " . $spammerEmailAddress . "\n";
$emailMessage .= "Spammer's Webpage URL = " . $spammerWebsite . "\n";
$emailMessage .= "Spammer's Signature Line = " . $spammerSignature . "\n";
mail($myEmailAddress, $emailSubject, $emailMessage, $emailHeader);
//**********
message_die(GENERAL_MESSAGE, "You are not authorized to use this feature. Please send e-mail to " . $myEmailAddress . " for more information.", '', __LINE__, __FILE__);
}
#
#-----[ FIND ]------------------------------------------
#
if ( $mode == 'editprofile' )
{
$template->assign_block_vars('switch_edit_profile', array());
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( $mode == 'editprofile' )
{
$template->assign_block_vars('switch_edit_profile', array());
if ($userdata['user_posts'] >= $cut_off)
{
$template->assign_block_vars('switch_edit_website', array());
}
}
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_add_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_WEBSITE}:</span></td>
<td class="row2">
<input type="text" class="post" style="width: 200px" name="website" size="25" maxlength="255" value="{WEBSITE}" />
</td>
</tr>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<!-- BEGIN switch_edit_website -->
<tr>
<td class="row1"><span class="gen">{L_WEBSITE}:</span></td>
<td class="row2">
<input type="text" class="post" style="width: 200px" name="website" size="25" maxlength="255" value="{WEBSITE}" />
</td>
</tr>
<!-- END switch_edit_website -->
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_SIGNATURE}:</span><br /><span class="gensmall">{L_SIGNATURE_EXPLAIN}<br /><br />{HTML_STATUS}<br />{BBCODE_STATUS}<br />{SMILIES_STATUS}</span></td>
<td class="row2">
<textarea name="signature" style="width: 300px" rows="6" cols="30" class="post">{SIGNATURE}</textarea>
</td>
</tr>
#
#-----[ REPLACE WITH ]------------------------------------------
#
<!-- BEGIN switch_edit_website -->
<tr>
<td class="row1"><span class="gen">{L_SIGNATURE}:</span><br /><span class="gensmall">{L_SIGNATURE_EXPLAIN}<br /><br />{HTML_STATUS}<br />{BBCODE_STATUS}<br />{SMILIES_STATUS}</span></td>
<td class="row2">
<textarea name="signature" style="width: 300px" rows="6" cols="30" class="post">{SIGNATURE}</textarea>
</td>
</tr>
<!-- END switch_edit_website -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM