Welcome Guest, Not a member yet? Register   Sign In
ReCAPTCHA library - ignited

[eluser]w0bbes[/eluser]
Ah ok, that gives me a better idea how use the code

[eluser]w0bbes[/eluser]
Still not working for me... such a shit description on how to work with code...

[eluser]ShoeLace1291[/eluser]
I'm getting the following CodeIgniter error:
Quote:Your application/config/recaptcha.php file does not appear to contain a valid configuration array.

This is my config file:

Code:
$config['recaptcha'] = array(
  'public' => '6LdpBMQSAAAAAB5T751cU1GPke0ZEOQphyqpoMla',
  'private' => '6LdpBMQSAAAAAOowMLM6HQxSM1v_rLG9hrQ4hfOu',
  'RECAPTCHA_API_SERVER' =>'http://www.google.com/recaptcha/api',
  'RECAPTCHA_API_SECURE_SERVER' => 'https://www.google.com/recaptcha/api',
  'RECAPTCHA_VERIFY_SERVER' =>'www.google.com',
  'RECAPTCHA_SIGNUP_URL' => 'https://www.google.com/recaptcha/admin/create',
  'theme' => 'red'
);

This happens when I view the demo controller.

[eluser]incog03[/eluser]
Does anyone have a fix for JayTee's code? I'm completely stuck with the validation bug - Incorrect Security Image Response that a few others here have reported


Just found the solution posted earlier - somehow missed it! Enjoy.

[quote author="kaluzhanin" date="1271611609"]I've solved the problem described above. The trick was to change the body of _qsendcode($data) function of the library. I've replaced call for http_build_query($data) with the code from general recaptchalib.php file from recaptcha.net:

Code:
function _qsencode($data) {
        log_message('debug',"Recaptcha::_qsencode(\n".print_r($data,TRUE)."\n)");
        //http_build_query() = PHP 5 ONLY!
        //return http_build_query($data);

        //from recaptchalib.php:
        $req = "";
        foreach ( $data as $key => $value )
                $req .= $key . '=' . urlencode( stripslashes($value) ) . '&';

        // Cut the last '&'
        $req=substr($req,0,strlen($req)-1);
        return $req;
    }

Now it works as charm. If this is the only thing that enforces usage of PHP 5, the restriction is lifted.

P.S. Still, it is very strange that the problem arose. I use PHP 5.1.3 in my development environment. Obviously, the problem is in http_build_query function(), but we can do without it.[/quote]

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

What I can do to fix that?

[eluser]Unknown[/eluser]
A fix for anyone still getting "Incorrect Security Image Response" and i bet your using ion auth?

Well on the create_user function when adding the recaptcha to it

The stock code is like this:
Code:
if ($this->form_validation->run() == true)
        {
        // input codes here i removed mine as i have changed them for my site    
    
        }
        if ($this->form_validation->run() == true && $this->ion_auth->register($username, $password, $email, $additional_data))
        { //check to see if we are creating the user
            //redirect them back to the admin page
            $this->session->set_flashdata('message', "User Created");
            redirect("auth", 'refresh');
        }

If you look it has 2 $this->form_validation->run(), so it tries to validate your captcha twice firstly correctly then the captcha changes so the second time it is validated as "Incorrect Security Image Response" as it is checked twice

So you need to change it so it only uses "$this->form_validation->run() == true" once like this:
Code:
if ($this->form_validation->run() == true)
        {
            
        // input codes here i removed mine as i have changed them for my site
$this->ion_auth->register($username, $password, $email, $additional_data)
        
//redirect after  
            
        }

Hope this helps with anyone else wondering why the captcha keeps coming back as incorrect.

[eluser]mr_madness[/eluser]
Hey JayTee, thank you very much for this library, saved me many times already ! Big Grin

Been reading the thread, but couldn't find anything regarding that --- Is there any progress on setting the theme as "custom" ? I'm really needing to do that, and found your library so useful and easy to use, would like to have that feature on it..

Thanks again buddy, nice piece of code ! Wink




Theme © iAndrew 2016 - Forum software by © MyBB