reCaptcha for submit – Pligg 1.0

Posted In Modules - By Geoserv On Sunday, June 21st, 2009 With 37 Comments

The Pligg CMS comes with many great components, SPAM protection isn’t one of them.  As with previous versions, Pligg developers have decided SPAM protection isn’t important.  Fellow members have come up with great solutions including our submit anti-spam solution but they ignored it.We released a way to prevent spam subissions by robots in version 9.9.5 that has worked magically for owners of the 9.9.5 version.

The modules works pretty well the same for version 1.0, why haven’t the developers adopted this method?  Who knows.

Here is how to do it for you 1.0 owners:

Step 1: open submit_step_1.tpl

Find:

<h2>{#PLIGG_Visual_Submit1_NewsSource#}</h2>
        <form action="{$URL_submit}" method="post" id="thisform">
                <label for="url">{#PLIGG_Visual_Submit1_NewsURL#}:</label>
                <input type="text" name="url" id="url" value="http://" size="55" />
               
                {checkActionsTpl location="tpl_pligg_submit_step1_end"}
               
                <input type="hidden" name="phase" value=1/>
                <input type="hidden" name="randkey" value="{$submit_rand}"/>
                <input type="hidden" name="id" value="c_1"/>
</form>

After, add:

{php}
require_once(‘recaptchalib.php’);
$publickey = "PUBLICKEY"; // you got this from the signup page
echo recaptcha_get_html($publickey);
{/php}
 

Step 2: open submit.php

Find:

// submit step 1
function do_submit1() {
        global $main_smarty, $db, $dblang, $current_user, $the_template;
 

after, add:

//captcha
if(enable_captcha == ‘true’) {

        require_once(‘recaptchalib.php’);
        // Get a key from http://recaptcha.net/api/getkey
        $publickey = "6LcgbAIAAAAAAI9nYv__8BgVklHK71UijWSTbIP4 ";
        $privatekey = "6LcgbAIAAAAAAMUqdB3ROC19UhxV6KcAgh34Gtq_";

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

        # was there a reCAPTCHA response?
        if ($_POST["recaptcha_response_field"]) {
                $resp = recaptcha_check_answer ($privatekey,
                                                $_SERVER["REMOTE_ADDR"],
                                                $_POST["recaptcha_challenge_field"],
                                                $_POST["recaptcha_response_field"]);

                if ($resp->is_valid) {
                        echo "Succesfully verified that you are human.";
                } else {
                        # set the error code so that we can display it
                        $error = $resp->error;

                }
        }    

        if (!$resp->is_valid) { // if incorrect captcha code was entered
            $main_smarty->assign(’register_error_text’, "badcode");
            $main_smarty->display($the_template . ‘/submit_errors.tpl’);
            return;
        }
        // fin capthca
 

Find:

}

// submit step 2
function do_submit2() {
 

replace with:

}}

// submit step 2
function do_submit2() {
 

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 here.

In the above snippets, retype all instances of the single apostraphe ( ‘ ) as they are not appearing properly here. In the download they will appear properly however.

If the user/bot fails to enter the correct reCaptcha code, they will be forwarded to your error page controlled by submit_errors.tpl, I have not come with a custom error message for this, maybe someone can submit one.

This should eliminate almost all spam submissions.

Related Search:

  • block spam pligg
  • block spam on pligg
  • recaptcha - on submit

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

  • Pingback: ReCapcha on submit step2 on pligg 1.0.0 | Pligg CMS Forum

  • Pingback: Pliggs

  • Pingback: Pliggs

  • Pingback: reCaptcha for submit – Pligg 1.0

  • http://growthbubble.com jerry

    i pretty sure u saw my replay at the pligg forum…..

  • http://www.faqpal.com Geoserv

    @Jerry, yes I did notice your post on the Pligg forums.

    Thanks for the mention.

  • http://www.topstumbles.com top stumbles today

    thanks for the guide.
    this is one of the best spam protection against pligg spammer.

  • Pingback: ReCapcha on submit step2 on pligg 1.0.0 | Pligg CMS Forum

  • Pingback: socialcmsbuzz

  • http://www.delhistarhotels.com/ Hotels In New Delhi

    Hotels in New Delhi- offer online information and booking of Hotels in Delhi, Hotels in New Delhi, New Delhi Hotels, and Hotels Delhi. We also provide list of Delhi hotels including Mega, star and medium hotels.

  • http://www.dzinestand.com/ Web Design

    Nice Post. Thanks For Sharing the Info for avoiding the Spamming.

  • http://www.homeexercisebikes.com/schwinn-231-recumbent-bike.php Schwinn 231 recumbent bike

    Very nice way of protection against spammers. Thanks for sharing such nice info.

  • http://www.gurgle.co.uk/articles/default.aspx gurgle

    Thanks for this, very helpful for our blogs.
    .-= gurgle´s last blog ..Cervical Smear Tests =-.

  • http://thetwittersecret.com/ Sweton F Fleming

    hey thanks for the updated info dear….i was really very thankful to you for the great info…

  • spicybookmarking

    Hello, I m getting this error.

    Fatal error: TPL: [in wistie/submit_step_1.tpl line 32]: syntax error: /php function does not exist (class.compiler.php, line 485) in /home/spicyboo/public_html/class.template.php on line 923

    can you please help me with this. thanks.

  • spicybookmarking

    Hello, I m getting this error.

    Fatal error: TPL: [in wistie/submit_step_1.tpl line 32]: syntax error: /php function does not exist (class.compiler.php, line 485) in /home/spicyboo/public_html/class.template.php on line 923

    can you please help me with this. thanks.

  • Pingback: ReCapcha on submit step2 on pligg 1.0.0 | Pligg CMS Forum

  • raghhav

    its ending up in blank page.

  • http://www.nezamanemekliolabilirim.net/ ne zaman emekli olabilirim

    Do you share a very useful article. learned thanks to you

  • http://www.zomoyun.com/ karal oyun

    hey thanks for the updated info dear….i was really very thankful to you for the great info…

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

    reCaptcha is really good for spam protection.

  • http://www.problemcocuk.com/ seo

    The company also is ahead of many of the other paper companies using recycled products. While there are many products using recycled paper, Marcal uses only 100% post consumer recycled in all of their products. There products also are far cheaper and can be found in many local grocery stores around the country. You may be surprised, but their prices are even cheaper than the major brands.

  • http://www.chiropractorsstpetersburg.com/ Chiropractor St Petersburg

    I'll install recaptcha on my blog. Thanks for information.

  • http://www.problemcocuk.com/ seo

    You looks like to me dou you know?? :)

  • http://www.seoritma.com/ SEO

    If wouldn't be nice if this site is located at the e recaptha , spammer fill here.

  • http://www.uggs-outlet-store.com UGG boots

    Well , the view of the passage is totally correct ,your details is really reasonable and you guy give us valuable informative post, I totally agree the standpoint of upstairs. I often surfing on this forum when I m free and I find there are so much good information we can learn in this forum!

  • http://www.aseks.com sex shop

    reCaptcha is really good for spam protections

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

    I've tried doing this but there is a non-trivial set of events being triggered in JS, and I'm not sure what the correct set of events IS. So that's why I was hoping to find a working installation I could look at to give me a baseline to compare against.

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

    Part of the reason this is difficult is it looks like the Javascript in question is written into the page at runtime by the reCaptcha plugin, which makes it non-trivial do debug (at least using my JS skills!)

  • http://www.agorshop.com/ şişme bebek

    its ending up in blank page. ;)

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

    reCaptcha is the Best tool for preventing Spammers

  • http://www.efytimes.com/e1/50626/fullnews.htm Tej Kohli

    reCaptcha is the Best tool for preventing Spammers

  • Merabasera

    i like it so much your article……………..

  • http://www.websolutionlab.com/seo-services.htm seo services india

    I am very Glad to see this info here…

    Keep it Up…

  • http://www.berelevantgroup.com Sales enablement

    nice trick! its a better way to stop spammers..

  • http://www.boldbodyfitness.com/ p90x

    This is great code to stop unwanted comments. I will give it a try and check back. Thanks for sharing.

    - Robert

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

    I am so new to all this online, the more I read the more I realize there’s so much more for me to learn, thanks for the awesome post I will be back!