The code shown below is not exactly what I used, for security reasons, but it's close enough that I believe it should work directly, or with minimal tweaking.
In .../templates/subSilver/profile_add_body.tpl, add two new form fields. One is an intelligence test (not to make sure users are smart, just to make sure they have human intelligence, meaning "they" aren't a script), the other is a hidden field. For example, find:
- Code: Select all
<!-- BEGIN switch_confirm -->
...and after it add:
- Code: Select all
<tr>
<td class="row1"><span class="gen">The opposite of hot is: *</span></td>
<td class="row2"><input type="text" name="humanCheck" size="25" maxlength="50" class="post" style="width:200px" /><input type="hidden" name="hidden_required_field" value="" /></td>
</tr>
Of course, you can extract the strings there to the language file if you feel that is necessary. Next, in .../includes/usercp_register.php, add code to handle the new fields when the script is handling a new registration. For example, find:
- Code: Select all
if ( isset($HTTP_POST_VARS['submit']) )
...and a few lines below it, after the session ID check, insert:
- Code: Select all
if ( $mode != 'editprofile' )
{
// Two custom fields for trying to stop spammer registration, let's see if this works...
// hidden_required_field must be blank, contrary to the implication of the name
// humanCheck must contain the word "cold" (case-insensitive and ignoring trailing spaces or punctuation)
$hidden_not_empty = ((isset($HTTP_POST_VARS['hidden_required_field'])) && ($HTTP_POST_VARS['hidden_required_field'] != ''));
$answer_not_cold = (strtoupper(substr($HTTP_POST_VARS['humanCheck'],0,4)) != 'COLD');
if ($hidden_not_empty || $answer_not_cold)
{
// Didn't get those fields right. Send them somewhere else...
header ("Location: http://one.revver.com/watch/52410/flv/affiliate/7340");
exit();
}
// Back to phpBB, already in progress...
}


