1 (edited by fhelik 2008-03-08 02:19)

Topic: Help with reCAPTCHA >>>>

Ok I already installed reCAPTCHA for new registrations, but now i need to install it for posts and replies.

my forum is and is in spanish so Register=Regístrate is you want to check it.


the forum is open to any one that want to post or reply, thats way i need this.




thanks for any help

Re: Help with reCAPTCHA >>>>

Hey - have you managed to figure this out yet? (I realize this top is a few months old now, so I thought I'd ask.)

If you haven't - or for anybody else who happens across this topic and wants to know how - here's how I did it on my forum:

1. If you haven't already done it, sign up for reCAPTCHA, and download the reCAPTCHA PHP Library at: http://recaptcha.net/

2. Again, if you haven't already done so, extract recaptchalib.php from the PHP Library into your punBB root directory.

3a. Open up post.php.

3b. Find (should be around line 27):

define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';

After it, add:

require_once('recaptchalib.php');
$publickey = "youpublickey";
$privatekey = "yourprivatekey";

(Obviously, replace yourpublickey and yourprivatekey with your public and private reCAPTCHA keys.)

3c. Find (should be around line 140):

if ($pun_config['p_force_guest_email'] == '1' || $email != '')
{
    require PUN_ROOT.'include/email.php';
    if (!is_valid_email($email))
        $errors[] = $lang_common['Invalid e-mail'];
}

After it, add:

$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
    message("The <b>reCAPTCHA</b> wasn't entered correctly. Go back and try it again.");
}

3d. Find (should be around line 531):

            <div class="inform">
                <fieldset>
                    <legend><?php echo $lang_common['Options'] ?></legend>
                    <div class="infldset">
                        <div class="rbox">
                            <?php echo implode('<br /></label>'."\n\t\t\t\t", $checkboxes).'<br /></label>'."\n" ?>
                        </div>
                    </div>
                </fieldset>
<?php

}

?>
            </div>

After it, add:

<?php
if ($pun_user['is_guest'])
{
?>
<div class="inform">
<fieldset>
<legend>Are you human?</legend>
<?php echo recaptcha_get_html($publickey, $error); ?>
</fieldset>
</div>
<?php
}
?>

4. Save, upload, and you're done!

A couple quick notes:
These instructions were written for punBB version 1.2.19 - though they should work for other 1.2.x versions, I can't guarantee it.

These instructions make it so that guests only, not registered members, are required to use the captcha. If you'd like to require a captcha for members and guests, and can't figure it out, let me know.

I probably couldn't have figured this out without a little help from 36 Invisible's article on setting up reCaptcha for punBB registrations - so thanks to him.

If you have any questions, just let me know!

Also: if anyone finds a better way to do this (I went in, with the exception of a few ideas from 36 Invisible's post, pretty much blind here), please let me know!

-Master Hob Bramble of Willowbottom

Pardon me, good sir, but it appears that your diving apparatus has a leak.
Perpetual Thursday | Alternative-Internet.com | hobbramble.deviantart.com

Re: Help with reCAPTCHA >>>>

hello please can you do it for 1.3?

Re: Help with reCAPTCHA >>>>

Hob Bramble, thanks for the notes on how you implemented reCAPTCHA. Very handy.

Re: Help with reCAPTCHA >>>>

Sirena - no problem! Glad you found em' handy!

Hey, Fantasma - sorry it's taken me so long to get back to you!
I haven't had the chance to test this yet (I might get the chance later tonight, but if I don't, just let me know if it doesn't work and I'll look into it), but I think this should work:

1. If you haven't already done it, sign up for reCAPTCHA, and download the reCAPTCHA PHP Library at: http://recaptcha.net/

2. Again, if you haven't already done so, extract recaptchalib.php from the PHP Library into your punBB root directory.

3b. Find (should be around line 28):

if (!defined('FORUM_ROOT'))
    define('FORUM_ROOT', './');
require FORUM_ROOT.'include/common.php';

BEFORE (not after) it, add:

require_once('recaptchalib.php');
$publickey = "youpublickey";
$privatekey = "yourprivatekey";

(Obviously, replace yourpublickey and yourprivatekey with your public and private reCAPTCHA keys.)

3c. Find (should be around line 158):

if ($forum_config['p_force_guest_email'] == '1' || $email != '')
{
    require FORUM_ROOT.'include/email.php';
    if (!is_valid_email($email))
        $errors[] = $lang_common['Invalid e-mail'];
}

After it, add:

$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
    message("The <b>reCAPTCHA</b> wasn't entered correctly. Go back and try it again.");
}

3d. Find (should be around line 531):

        <fieldset class="frm-set set<?php echo ++$forum_page['set_count'] ?>">
            <legend class="frm-legend"><strong><?php echo $lang_post['Optional legend'] ?></strong></legend>
            <fieldset class="frm-group">
                <legend><span><?php echo $lang_post['Post settings'] ?></span></legend>
                    <?php echo implode("\n\t\t\t\t\t\t", $forum_page['checkboxes'])."\n"; ?>
            </fieldset>
        </fieldset>
<?php

}

($hook = get_hook('po_post_optional_fieldset')) ? eval($hook) : null;

?>

After it, add:

<?php
if ($pun_user['is_guest'])
{
?>
<div class="inform">
<fieldset>
<legend>Are you human?</legend>
<?php echo recaptcha_get_html($publickey, $error); ?>
</fieldset>
</div>
<?php
}
?>

4. Save, upload, and you're done!

Again - this will only make the captcha apply to guests, not registered members - and again, I haven't tested it yet. If I do get the chance to test it, I'll post/make an edit later tonight to say whether or not it worked. I'm pretty sure it will, though, as the code is pretty much the same.

-Master Hob Bramble of Willowbottom

Pardon me, good sir, but it appears that your diving apparatus has a leak.
Perpetual Thursday | Alternative-Internet.com | hobbramble.deviantart.com

Re: Help with reCAPTCHA >>>>

What is the flow for the user if using this implementation? Looks like this method uses reCaptcha for posting? How does this apply if you have no guest posting access?

Looks like there is a proper plugin for 1.3 beta, but is there a way to similarly use recaptcha for registrations using 1.2.19?

Re: Help with reCAPTCHA >>>>

Yes, this uses reCAPTCHA for posting - using this method, if you are a guest, and you want to post a topic/reply, you'll see a reCAPTCHA box on the posting page, which you'll need to pass to post. You can see an example at: http://www.alternative-internet.com/for … hp?tid=129

Since this method only applies to guest posts (i.e. regular users can post as they normally would - no captcha required), if you don't allow guests to post, then this method doesn't do anything.

Setting up reCAPTCHA for registrations is a very similar process - the method I've described here for applying it to posts is somewhat based of a 36invisible blog post on how to implement reCATPCHA for registrations in 1.2.15. (As far as I know, applying it to 1.2.19 shouldn't be any different.)

You can find the post at: http://news.36invisible.com/2007/08/05/ … for-punbb/

Hope that helps!

-Master Hob Bramble of Willowbottom

Pardon me, good sir, but it appears that your diving apparatus has a leak.
Perpetual Thursday | Alternative-Internet.com | hobbramble.deviantart.com

Re: Help with reCAPTCHA >>>>

Just got this installed with your help.

The 36invisible blog method works smashing on 1.2.19!

Thank you Hob Bramble!

Re: Help with reCAPTCHA >>>>

I am so happy to have reCAPTCHA part of the registration process because I was having 3 or 4 spam registrations from bots everyday...

Thank you! cool

10

Re: Help with reCAPTCHA >>>>

itsanogo wrote:

I am so happy to have reCAPTCHA part of the registration process because I was having 3 or 4 spam registrations from bots everyday...

only 3 or 4?

pfft.. one of my sites got nearly 200 a day. hmm

Re: Help with reCAPTCHA >>>>

Too bad this doesn't work in v1.3 sad

wink wink