Part of the EllisLab Network
   
 
reCAPTCHA 2
Posted: 08 November 2008 08:12 AM   [ Ignore ]  
Summer Student
Total Posts:  14
Joined  11-04-2008

Hello everyone!
This code is originally is written by: vendiddy (Topic) but, it’s using old validation class.
This one is packed and it uses new version of validation class.

Important! You must have account on reCAPTCHA.NET to get public and private keys. Without keys, this addon won’t work!!

Pack is here, it contains ReadMe and code.

Hope you’ll like this one.
Please report bugs and etc here.
Thanks.

Edit:
You can also download this addon from Wiki .

File Attachments
reCAPTCHA.zip  (File Size: 10KB - Downloads: 1237)
 Signature 

“I never think of the future - it comes soon enough.” - Albert Einstein.

Profile
 
 
Posted: 08 November 2008 12:10 PM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  148
Joined  10-22-2008

Thanks

 Signature 

DX Auth library - User guide

Profile
 
 
Posted: 08 November 2008 02:06 PM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  14
Joined  11-04-2008

Np, when you guys test it out, please let me know smile

 Signature 

“I never think of the future - it comes soon enough.” - Albert Einstein.

Profile
 
 
Posted: 16 November 2008 07:16 AM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  141
Joined  02-16-2008

I did have a small issue with this.

Due to extanding the Form Validation I had to do add this->  before CI. ie.

function recaptcha_matches()
    
{
        $this
->CI =& get_instance();
        
$this->CI->config->load('recaptcha');
        
$public_key $this->CI->config->item('recaptcha_public_key');
        
$private_key $this->CI->config->item('recaptcha_private_key');
        
$response_field $this->CI->input->post('recaptcha_response_field');
        
$challenge_field $this->CI->input->post('recaptcha_challenge_field');
        
$response recaptcha_check_answer($private_key,
                                           
$_SERVER['REMOTE_ADDR'],
                                           
$challenge_field,
                                           
$response_field);
        if (
$response->is_valid)
        
{
            
return TRUE;
        
}
        
else
        
{
            $this
->CI->form_validation->recaptcha_error $response->error;
            
$this->CI->form_validation->set_message('recaptcha_matches''The %s is incorrect. Please try again.');
            return 
FALSE;
        
}
    } 

Hope this helps.

 Signature 

weblee.co.uk - Web Development Blog
Screencasts - CI Screencasts.

Profile
 
 
Posted: 05 December 2008 09:59 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  107
Joined  05-19-2007

Anyone know how to get two recaptchas on one page? It currently will only display the second recaptcha.

Profile
 
 
Posted: 06 December 2008 08:39 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  107
Joined  05-19-2007

For those wondering, I had to use the ajax method: http://recaptcha.net/fastcgi/demo/ajax

Profile
 
 
Posted: 14 January 2009 09:47 PM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  107
Joined  05-19-2007

Okay, now I’ve been informed that it’s throwing an error. When you submit the form the “To use reCAPTCHA you must get an API key from…” error pops up. Any ideas?

Profile
 
 
Posted: 20 January 2009 07:23 AM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  316
Joined  05-08-2008

Hello!

anyone had success while, loading the VALIDATION settings from form_validation.php ?
if i put the vali settings there, it dosnt seem to work :(

Profile
 
 
Posted: 17 May 2010 09:00 AM   [ Ignore ]   [ # 8 ]  
Summer Student
Total Posts:  3
Joined  05-17-2010

I have added this function in my Form_validation.php. is it important to add the helper MY_Validation_helper.php. i am not able to check if the captcha enterd is correct or not. there is no validation applying on captcha field. i.e. recaptcha_challenge_field. help please.

OES - 16 November 2008 12:16 PM

I did have a small issue with this.

Due to extanding the Form Validation I had to do add this->  before CI. ie.

function recaptcha_matches()
    
{
        $this
->CI =& get_instance();
        
$this->CI->config->load('recaptcha');
        
$public_key $this->CI->config->item('recaptcha_public_key');
        
$private_key $this->CI->config->item('recaptcha_private_key');
        
$response_field $this->CI->input->post('recaptcha_response_field');
        
$challenge_field $this->CI->input->post('recaptcha_challenge_field');
        
$response recaptcha_check_answer($private_key,
                                           
$_SERVER['REMOTE_ADDR'],
                                           
$challenge_field,
                                           
$response_field);
        if (
$response->is_valid)
        
{
            
return TRUE;
        
}
        
else
        
{
            $this
->CI->form_validation->recaptcha_error $response->error;
            
$this->CI->form_validation->set_message('recaptcha_matches''The %s is incorrect. Please try again.');
            return 
FALSE;
        
}
    } 

Hope this helps.

Profile
 
 
Posted: 16 May 2011 03:47 PM   [ Ignore ]   [ # 9 ]  
Summer Student
Total Posts:  7
Joined  08-30-2010

An Error Was Encountered
Your application/config/recaptcha.php file does not appear to contain a valid configuration array.

What I can do?

Profile
 
 
Posted: 11 August 2011 09:28 AM   [ Ignore ]   [ # 10 ]  
Summer Student
Avatar
Total Posts:  2
Joined  08-10-2011
Jujubins - 16 May 2011 07:47 PM

An Error Was Encountered
Your application/config/recaptcha.php file does not appear to contain a valid configuration array.

What I can do?

you have to show error in your view like this.

echo form_error('recaptcha_challenge_field''<p class="error">''</p>'); 

Thank you very much Blazeme, you save my life from spammer:)

Profile