MyBB Community Forums

Full Version: [1.8][1.6] Stop Forum Spam Registration with a Hidden Field
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Tested with 1.6 but should be the same for 1.8

This will pretty much stop all Spam Registrations.

I got the idea from this post: http://www.returnondigital.com/blog/how-...ng-captcha

What this does is add an invisible field. If anything gets entered into that filed, Registration is declined.

At the moment Spambots struggle with recognizing required fields and reading CSS. So they tend to fill in all empty fields. Doesn't matter if the field is hidden or required.

Because of this, this technique is extremely effective at preventing spam registrations.

To start go to:

Admin CP, Template & Styles > Templates > (your template) > member_register


And find:

{$requiredfields}

Above this enter:

<input id="this_title" type="text" name="this_title" value="" />

You should end up with something that looks like this:

</fieldset>
<input id="this_title" type="text" name="this_title" value="" />

{$requiredfields}
{$referrer}

Save the changes then go to:

Admin CP, Template & Styles > Themes > (your template) > global.css > Edit Stylesheet: Advanced Mode

Then add:

#this_title{display:none;}

To the very top (this will hide the field from normal users).

Then save the changes.

Next download global.php from the root of your MyBB install.

Open global.php with a text editor and find:

<?php

Now add this directly under it:

             
$this_form_spam = $_POST['this_title'];
	        if ($this_form_spam == "")
                {
                // process the form and send email
                }
                 else
                {
                die();
                }

So what you end up with is something like this:

             
 <?php
$this_form_spam = $_POST['this_title'];
if ($this_form_spam == "")
{
// process the form and send email
}
 else
{
 die();
}
/**
 * MyBB 1.6
 * Copyright 2010 MyBB Group, All Rights Reserved
 *
 * Website: http://mybb.com
 * License: http://mybb.com/about/license
 *
 * $Id$
 */

$working_dir = dirname(__FILE__);

Once edited upload global.php to the root of your MyBB install.


Now if any spam bots enter anything into the invisible field the Registration will be declined.


I have also added:

<input id="this_title" type="text" name="this_title" value="" />

To my Contact Us and Donate templates.
thank i needed this