Quote:
Originally Posted by MarekSpace So I see why you would want reCaptcha for adding new stories but what about the first step which is when they register? Wouldn't that alleviate the problem of spam bots creating accounts? |
This works for me.
1) In register_center.tpl add this:
{if isset($form_captcha_error)}{ foreach value=error from=$form_captcha_error }<br /><span class="error">{$error}</span><br />{ /foreach }<br />{/if}
{php}
require_once('recaptchalib.php');
$publickey = "..."; // you got this from the signup page
echo recaptcha_get_html($publickey);
{/php}
BEFORE THIS
<input type="submit" name="submit" value="{#PLIGG_Visual_Register_Create_User#}" class="log2" tabindex="36" />
2) In register.php add this:
require_once('recaptchalib.php');
$privatekey = "...";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) { // if both captchas don't match
$error = true;
}
BEFORE THIS
$vars = array('username' => $username);
check_actions('register_check_errors', $vars);
AND THIS
$main_smarty->assign('form_captcha_error', 'The reCAPTCHA code you entered was incorrect.');
AFTER THIS
$main_smarty->assign('form_password_error', $form_password_error);