Adding reCaptcha to comments

Posted In Modules - By Geoserv On Tuesday, August 11th, 2009 With 93 Comments

Like most of you, I have had more than enough SPAM on my sites. One of the biggest sources is in the comments section. Let’s put an end to them now.

I have already shown you how to prevent spam bots from submitting stories by using the fabulous tool, reCaptcha, now let’s add it to the comment form as well.

To add it to your comment form, just do the following steps:

Download the latest reCaptcha library from here and upload to your “root”.

You will also need reCaptcha keys for your site, you will need to register and add your site to reCaptcha. Register for reCaptcha keys here.

Open comment_form.tpl, find:

{if $Spell_Checker eq 1}
<input class="log2" onclick="openSpellChecker(‘comment’);" name="spelling" type="button" value="{#PLIGG_Visual_Check_Spelling#}" />{/if}

After, add:

{php}

require_once(‘recaptchalib.php’);
$publickey = "ENTER PUBLIC KEY HERE";
$privatekey = "ENTER PRIVATE KEY HERE";

# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;

# are we submitting the page?
if ($_POST["submit"]) {
  $resp = recaptcha_check_answer ($privatekey,
                                  $_SERVER["REMOTE_ADDR"],
                                  $_POST["recaptcha_challenge_field"],
                                  $_POST["recaptcha_response_field"]);

  if ($resp->is_valid) {
    echo "You got it!";
    # in a real application, you should send an email, create an account, etc
  } else {
    # set the error code so that we can display it. You could also use
    # die ("reCAPTCHA failed"), but using the error message is
    # more user friendly
    $error = $resp->error;
  }
}
echo recaptcha_get_html($publickey, $error);
{/php}

save. Thats it.

Here is the updated comment_form.tpl file with the reCaptcha code added. –

  Comment Form (1.7 KiB, 362 hits)

This will eliminate all comments being left by spam bots and will also make human spamming less atractive as well.

If you use this module, leave me a comment below or perhaps think of linking back to http://www.pliggs.com

Be sure to follow me on Twitter as well for one on one help and news.

Are you willing to purchase travel insurance for getting incredible online 350-030 courses and 000-104 prep guides? We also provide best comptia security+ dumps & mcp certification with guaranteed success.

Related Search:

  • comments on recaptcha
  • comments_recaptcha
  • fix ReCaptcha public key
  • recaptcha comments
  • recaptcha for comments

About - Geoserv has been working with the Pligg CMS for 2+ years.

  • Pingback: Pliggs

  • Pingback: You are now listed on FAQPAL

  • Pingback: Vote on this article at blogengage.com

  • Pingback: Adding reCaptcha to comments

  • http://www.k2seo.com/index.php/ MONI

    WOW! Great piece of information provided.Very well written article, to the point.Thanks for sharing. It is definitely going to help the beginer like me.
    .-= MONI´s last blog ..Ping multiple sites to get more traffic on your blog. =-.

  • http://www.asswass.com Asswass

    I don’t think I need captcha. Akismet does an amazing job for my blog.
    .-= Asswass´s last blog ..Story behind Hiburrito – Best Polls for Blogs (Part 3) =-.

  • Pingback: Alfred V.

  • http://twitter.com/Asswass/statuses/3269461807 Asswass (Alfred V.)

    Twitter Comment


    RT @Pliggs Adding reCaptcha to comments [link to post]

    Posted using Chat Catcher

  • http://twitter.com/Pliggs/statuses/3245285362 Pliggs (Pliggs)

    Twitter Comment


    Adding reCaptcha to comments [link to post] #spam #recaptcha #pligg

    Posted using Chat Catcher

  • http://www.seomkt.com/ bbrian017

    I never could get the Captcha working on the story submissions without affecting the EVB. I will give this a try and see how it works!

    Thanks so much for your efforts!

  • http://www.faqpal.com Pliggs

    What did the reCaptcha on submission do to your EVB? It shouldn't effect the button as the reCaptcha in on step 1 and the button bypasses this step.

  • http://www.seomkt.com/ bbrian017

    That's the issues, the EVB brings you to step 2 and with the Captcha it says you entered the Captcha wrong.

    I remember we got it working but the EVB was an issue!

  • http://www.faqpal.com Pliggs

    Let me look into it, I will see if there is an easy fix.

  • http://www.seomkt.com/ bbrian017

    no no don't worry about it my friend!

    I totally re arranged blogengage so members don't see the upcoming anymore. I simply publish everything that has an avatar. I use pligg but have managed to create a unique community from it and it's not based on upcoming at all.

    But I will be trying this Captcha on the comments!

  • http://www.faqpal.com Pliggs

    Yeah I noticed that. Let me know how the comments works out.

  • Pingback: Pliggs

  • Pingback: AXL Softwares

  • testing

    testing

  • http://www.gokgunlugu.com uzaysitesi

    Good information.Thank you for shairng:)

  • http://www.microsoft.com/ Bob

    Comment

  • http://bestdogforme.com/ dogs mating

    hi,
    Thanks for nice sharing.it is a different and good post….

  • http://www.officeinbeverlyhills.com/ Office Space Los Angeles

    Very new concept for me as well may for others also about recaptcha very few of knows, and most of bloggers facing problem of spamming at there blog so your given code greatly helpful for all…..

  • http://www.growth-flexvpro.net/ Jenny

    I just hope they wont make bots for reCaptcha aswell!! :s

  • http://www.wholesaletoner.com.au/hp-laser-cartridges-c-116_180.html hp laser cartridges

    We are waiting for another interesting update. Its very long time that you have not update your blog.

  • Pingback: Priyesh Das

  • http://www.sellthecar.com/ sell my car

    I have bookmarked this tutorial and soon use it for my blog.

  • http://www.recoverybull.com/ Brian Reed

    Very new and good concept using that we can easily secure From Spam…Nice one thanks for sharing…

  • http://www.recoverybull.com/ Brian Reed

    Very new and good concept using that we can easily secure From Spam…Nice one thanks for sharing…

  • http://www.wholesaletoner.com.au/hp-laser-cartridges-c-116_180.html hp laser cartridges

    Yes my friend this is comment problem of spaming and recaptcha will help in remove that.

  • http://www.sellthecar.com/ sell my car

    I think last month have been passed away now you should update your site. I look forward to see you again with a new post.

  • http://www.sellthecar.com/ sell my car

    It will help in decreasing spamming and will work as a weapon against spamming.

  • http://www.uprinting.com/Brochure-Printing.html Brochure Printing

    Cool… thanks for sharing this! I find reCaptcha useful, and fascinating, at the same time. :D Will try this one out!

  • http://www.tampabaypos.com/ Restaurant POS Systems

    Good idea about recaptcha. Thanks for code of re-captcha.

  • goutamsarkar

    This code not working in pligg 9.9.5 version.

  • http://www.faqpal.com Pliggs

    I have added the comment_form.tpl with the reCaptcha added to the post.

  • http://www.focusapartments.com.au/ Surfers paradise

    Hey ! You can't.. Captcha's only appear when someone has reached a certain amount of comments made within a day. It's part of Myspace's SPAM filter.

  • http://bestdogforme.com/ dogs mating

    They say it helps decode badly scanned text from books, but couldn't it be easily linked to a bot that runs into CAPTCHAs and uses the unsuspecting, do-gooders to solve them.

  • http://bestdogforme.com/ dogs mating

    reCAPTCHA is made by those who created the CAPTCHA in the first place: Carnegie Mellon University – a very well-respected educational institution. reCAPTCHA uses a public/private key pair to protect the CAPTCHA system from being used the way you describe.

  • http://bestdogforme.com/ dogs mating

    How do I add reCAPTCHA to an html form and how do you make it redirect to another page if the CAPTCHA code is correct?

  • http://love-cards.de/ Geburtstagskarten-liebeskarten

    Great Insight Enjoyed reading your blog. Hope to see some more stuff from you in future

  • http://www.exportimportpolicy.com/ Chou

    I think captcha is part of new pligg 1.0.3 v. Thanks

  • http://www.indirmix.net vektörel

    Good idea about recaptcha. Thanks for code of re-captcha.

  • http://www.indiahousing.com/ Property in India

    For some reason my myspace account requires people to solve Captcha Codes when adding/messaging/or commenting?

  • http://www.07il.com/ antalya

    For spammer I wanna use it. But some words can not be read. How can I use it most easy?

  • http://karasuhuzuremlak.com karasu emlak

    Is this working on pligg 9.9.5 ?

  • Guest

    testing

  • http://www.merabasera.com/ Sell Property

    Yap, recaptch canhelp to spam over a large amount. I must say than you for the code

  • http://www.costumesupercenter.com/ Jeffreyholland00

    putting captcha before posting the comment will help to prevent spammer.

  • http://www.agorshop.com/ erotik shop

    Good idea about recaptcha. Thanks a lot ;)

  • http://carhireshop.com.au/ Car Hire Shop

    thanks a lot!