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, 321 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:

  • add recaptcha to comment_form
  • comment recaptcha
  • how to add recaptcha to comment form
  • how to comment recaptcha

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

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

    For some reason my myspace account requires people to solve Captcha

  • http://www.usedtiresdealers.com used tires

    It's great to see you taking action by applying this recaptcha code to blogs. Though at the moment, I don't see it currently live on your blog? So I am going to assume it is for us the readers to use :)

    Till then,

    Jean

  • http://www.diycarhire.com.au car hire

    If I can't add it to an HTML form, how can I make a PHP form with JUST the reCAPTCHA and a submit button that redirects to another page.

  • http://www.bedsforlife.com.au Beds Melbourne

    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://carhireshop.com.au/ Car Hire Shop

    recaptcha are my favorites for every app. Otherwise we keep receiving spams all the time.

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

    It's great to see you taking action by applying this recaptcha code to blogs. ;)

  • http://www.allvoices.com/contributed-news/5807173-tej-kohli-ipad-review Tej Kohli

    you haven't applied this in your blog. may i ask why? interesting past by the way :)

  • http://www.spinxwebdesign.com/ Web Design Los Angeles

    ReCaptcha really helps in making spamming less. This is a new strong way.

  • http://www.canedirectfurniture.co.uk/ outdoor furniture

    Thanks for sharing this valik! I have been searching for a solution such as this. Cheers!

  • http://www.openmarketrealty.com/ Homes for sale

    Let me know how can going on much spamming due to commenting??

  • http://www.spinxwebdesign.com/ Web Design Los Angeles

    Good solutions and I would surely implement it.

  • http://www.spinxwebdesign.com/ Web Design Los Angeles

    Good solutions and I would surely implement it.

  • http://www.can-c.net/ Cataracts Drops

    today it's biggest problem that how to prevent website from spam..

  • http://www.can-c.net/ Cataracts Drops

    Recaptcha is good to prevent the spam , u can stop software to do automatically

  • Merabasera

    thanks for the dear you share with us your information.keep it up dear………take care

  • http://www.iblworld.com/ Power generator

    ReCaptcha seriously aids in creating spamming less. This is a brand new robust way.

  • http://www.turkeytourmarket.com istanbul tour

    Good solutions and I would surely implement it. :)

  • http://www.sareez.com/Salwar-collection/ online salwar kameez

    keep using! and dont think u r wasting ur time by typing captcha but indirectly u r helping for conversion.

  • http://www.iblworld.com/ Generators in NCR

    keep using! and dont feel u r wasting ur time by typing captcha but indirectly u r helping for conversion.

  • Generators in NCR

    hold working with! and dont feel u r losing ur time by typing captcha but indirectly u r assisting for conversion.

  • http://www.PERSONALSTUDENTLOANCONSOLIDATION.com PERSONAL STUDENT LOAN

    As with everything, a few ruin it for the many. I always end up with problems getting a captcha to work for me. Maybe following these instructions will be able fix it. Thanks. Keep giving good tips

  • http://www.rightwaysolution.com Web Development

    Yes, recaptcha should use for prevent automated submission and spamming.

  • http://www.komododragonfacts.com Komodo Dragon

    reCaptcha is a must to keep spammers at bay. It’s been highly successful for many years. What’s more important is it’s been constantly updated to keep up. That’s helped it stay one step ahead of spam.

  • http://www.libertyforexchange.com Liberty Reserve

    It is must to add recaptcha. Now a days, spammers are using lot of tools to blogs. Recaptcha helps a lot.

  • http://www.carracinggamesonline.org car games

    reCaptcha is a must in our days,when everything is done by sofwares.

  • http://www.cookinggamesforgirlsandboys.com cooking games

    I just taked the COmment_Form and installed it work perfectly.I’m glad to found this.
    Thanks

  • http://www.buyutmepenis.com/ Penis Büyütücü Bitkisel

    really useful solution.

  • http://sismebebekal.net şişme bebek

    reCaptcha is a must in our days ;)

  • http://www.scarygamesnow.com Scary Games

    love this article

  • http://mycartoonnetworkgames.com Cartoon Network Games

    Recaptcha to comments still protects form robot spams,good work.

  • http://www.canvasmemories.ca prints on canvas

    I admire what you have done here. I like the part where you say you are doing this to give back but I would assume by all the comments that this is working for you as well.

  • http://www.canvasmemories.ca fine art print

    Im glad to see that people are actually writing about this issue in such a smart way, showing us all different sides to it. Youre a great blogger.

  • http://www.canvasmemories.ca fine art print

    sometime when i comment and then write captcha but i found again and again..

  • http://www.albenishop.com/ seks shop

    great ;)

  • http://www.lucaslabels.ie Printer consumables

    yes its good for evryone.

  • http://www.hairup.gen.tr sac cikarici

    Breast Augmentation: Breast bottom 3 or 4 cm. cut the breast tissue, the implant is placed behind the pre-operative. If the breast has the desired size of the operation is completed. Generally, demand removal of the chest to measure the direction of the small height and 85 C `. Performed 1-2 hours after the procedure the patient is discharged the same day, but you must rest for 2-3 days.

  • http://www.disbeyazltmakalemii.com diş beyazlatma kalemi

    Teeth Whitening item WhitePen What are the effects?
    1) If the WhitePen so much faster the tooth whitening pen, it is not harmful to teeth?
    WhitePen tooth whitening pen, used by dentists to protect teeth enamel contains peroxide.

  • http://www.sibinfotech.com/ SEO Services Mumbai

    How many type of captha available and which are they! did any one have answer of this? thanks in advance.

  • http://www.websiteseoprofessionals.com SEO Professionals

    WHY I LIKE reCAPTCHA
    - It’s free.
    - It works.
    - There is no messing around with copying code into your blog template.
    - No permissions to change. (CHMOD isnt hard once you know what you’re doing but the learning curve before that has befuddled many a beginner, I’d say.)
    - A feel-good bonus is the fact that you’re helping the Internet Archive to improve the accuracy of its Optical Character Recognition software.

  • http://www.bayan-escortcu.com Bayan Escort

    Breast Augmentation: Breast bottom 3 or 4 cm. cut the breast tissue, the implant is placed behind the pre-operative. If the breast has the desired size of the operation is completed. Generally, demand removal of the chest to measure the direction of the small height and 85 C `. Performed 1-2 hours after the procedure the patient is discharged the same day, but you must rest for 2-3 days.

  • Guest

    need captcha to post on this page ?

  • Guest

    no…

  • http://www.collegebookrenter.com/rent.cfm Book Rentals

    I don’t use recaptcha but I use another one that has a check-box, and if my site still thinks it might be spam they have to read and follow directions to be pushed through, it will give 5 numbers and then ask you to input the 3rd and 5th number.  Works really well.