ABOUT

XMB reCAPTCHA v1.0
Compatible with XMB v1.9.7

This XMB hack adds reCAPTCHA to your registration process, stopping spambots
from invading your forum.

For information on CAPTCHA see: http://en.wikipedia.org/wiki/Captcha
For information on reCAPTCHA see: http://recaptcha.net/


INSTALLATION

-------------------------------------------------------------------------Step 1:
Obtain a public and private key by signing up at: http://recaptcha.net/

You'll need the keys for step 5, where you should replace the text YOUR PUBLIC 
KEY and YOUR PRIVATE KEY with the keys you get from recaptcha.

-------------------------------------------------------------------------Step 2:
Extract the contents of recaptcha-php-1.9.zip to a temporary directory and then
upload the file recaptchalib.php into the include directory of your forum.

-------------------------------------------------------------------------Step 3:
Create new template called member_reg_recaptcha with the following contents:

<tr>
<td class="tablerow altbg1" valign="top">Are you human?</td>
<td class="tablerow altbg2">$recaptchaHTML</td>
</tr>

-------------------------------------------------------------------------Step 4:
Edit member_reg template

find:
<tr>
<td class="tablerow altbg1" width="22%">$lang[textemail]</td>
<td class="tablerow altbg2"><input type="text" name="email" size="25" /></td>
</tr>

add after:
$recaptchatd

-------------------------------------------------------------------------Step 5:
in member.php

find:
            if ($SETTINGS['emailcheck'] != "on") {
                eval('$pwtd = "'.template('member_reg_password').'";');
            } else {
                $pwtd = '';
            }

add after:

// reCAPTCHA start /////////////////////////////////////////////////////////////
            require_once('include/recaptchalib.php');
            $publickey = 'YOUR PUBLIC KEY';

            $recaptchaHTML = recaptcha_get_html($publickey, null);
            eval('$recaptchatd = "'.template('member_reg_recaptcha').'";');
// reCAPTCHA end ///////////////////////////////////////////////////////////////

find:

        if (trim($username) == '') {
            error($lang['textnousername']);
        }

add after:

// reCAPTCHA start /////////////////////////////////////////////////////////////
        require_once('include/recaptchalib.php');
        $privatekey = 'YOUR PRIVATE KEY';

        // the response from reCAPTCHA
        $resp = null;

        // only check with reCAPTCHA if a response was received
        if ($recaptcha_response_field) {
            $resp = recaptcha_check_answer($privatekey,
                                           $_SERVER['REMOTE_ADDR'],
                                           $recaptcha_challenge_field,
                                           $recaptcha_response_field);
        }

        // was it correct?
        if(!$resp || $resp->is_valid == false) {
            error('CAPTCHA incorrect');
        }
// reCAPTCHA end ///////////////////////////////////////////////////////////////