Go Back   Pligg Forum > Pligg Development > Pligg Mods
Reply
 
LinkBack Thread Tools Display Modes
  #21 (permalink)  
Old 07-17-2008, 04:16 PM
momo momo is offline
New Pligger
 
Join Date: Aug 2007
Posts: 1
Downloads: 4
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Red face Another version of Recaptcha when Submitting News Stories

Thanks ruptan for all the work that was done on this. After reviewing your post and the attached files, I noticed an error in the post that was not in the attached files. I also modified the behavior so that when a user enters an invalid Captcha, the user will return to the same page with the error message from recaptcha.

First, I am using Pligg 9.9.0

Step 1: Open submit_step_2.tpl:

Find :
PHP Code:
<input type="submit" value="{#PLIGG_Visual_Submit2_Continue#}" class="submit" /> 
BEFORE THIS PLACE:
PHP Code:
            <?php 
                
require_once(captcha_captchas_path '/reCaptcha/libs/recaptchalib.php');
                
$publickey get_misc_data('reCaptcha_pubkey'); // you got this from the signup page
                
echo recaptcha_get_html($publickey);
            
?>
(this code was found in modules->captcha->captchas->recaptcha->captcha.tpl)
Step 2: Open Submit.php (this is where the typo is on ruptan's post).

Find:

PHP Code:
// submit step 2

function do_submit2() {
    global 
$db$main_smarty$dblang$the_template$linkres$current_user
AFTER THIS PASTE:
PHP Code:
//captcha
if(enable_captcha == 'true') {
            
        require_once(
'recaptchalib.php');        
        
// Get a key from http://recaptcha.net/api/getkey
        
$publickey "YOURPUBLICKEY";
        
$privatekey "YOURPRIVATE";
        
        
# 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
              
echo $error;
            
do_submit1();
            return;
        }
        
// fin capthca 
Step 3:

In Submit.php,

FIND:

PHP Code:
}

// submit step 3 
REPLACE WITH:
PHP Code:
} }

// submit step 3 
In Summary: The code listed on the site for submit.php incorrectly places new captcha code in such a way that the function do_submit2() never gets created. However, the code listed in the attachment is correct. If you don't look at that code, you will not get this to work. I also changed the behavior so that if it is a human who typed wrong, they can refill the submit page.

Thanks again for even figuring this stuff out, I hope that this post clarifies some of the issues you may encounter getting this to work.

Kudos also goes to ednet, who had a similar post. His showed me the typo I pointed out...

[Mod] Dodging SPAM with recaptcha

If you'd like to see an example: www.TotalExperience.com
Reply With Quote
Sponsored Links
Check out the New Templates at the Pligg Pro Shop.
  #22 (permalink)  
Old 07-18-2008, 07:59 AM
onlinebisnes onlinebisnes is offline
Casual Pligger
 
Join Date: May 2007
Posts: 68
Downloads: 20
Uploads: 0
Thanks: 5
Thanked 1 Time in 1 Post
Great! finally a working Recapcha mod for pligg 0.9.9
Thanks
__________________
Submit Your Pligg Site to Pligg Directory
Reply With Quote
Reply



Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
[Mod] Dodging SPAM with recaptcha ednet Pligg Mods 22 08-09-2008 01:48 PM
Request: reCAPTCHA elindbloom Suggestions 1 06-24-2007 09:02 PM


LinkBacks Enabled by vBSEO 3.0.0