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

[eluser]JayTee[/eluser]
[quote author="mooger" date="1200825220"]Hi.
I get an error when I try to use it.
Code:
Fatal error: Unsupported operand types in \system\application\libraries\Recaptcha.php on line 186

I could use some help. Any ideas?[/quote]

You're using PHP5, right?
#22

[eluser]Kitsched[/eluser]
Very nice plugin / library but there's one thing missing from the examples.
How does the developer verify that the user submitted the correct value?
#23

[eluser]Greg Aker[/eluser]
Not to bring up an old post, but I would like to second Kitsched's comment. How do we check to make sure the answer is correct before processing a form?

Thanks,

-greg
#24

[eluser]JayTee[/eluser]
I run it as part of the validation routine as a custom rule. Here's the function:
Code:
function check_captcha($val) {
  $this->recaptcha->recaptcha_check_answer($_SERVER["REMOTE_ADDR"],$this->input->post('recaptcha_challenge_field'),$val);
  if ($this->recaptcha->is_valid) {
    return true;
  } else {
    $this->validation->set_message('check_captcha','Incorrect Security Image Response');
    return false;
  }
}
It's a part of the validation rule
Code:
$rules = array(
  'recaptcha_response_field'=>'required|callback_check_captcha'
);
$this->validation->set_rules($rules);

Hope this helps. I know I need to tweak the code (and make it better) - I've just been swamped lately.
#25

[eluser]Greg Aker[/eluser]
JayTee:

This is killin', many, many thanks.

I understand being swamped. To say "thanks for the help," and to hopefully return the favor, I added the information (which worked perfectly) to your WIKI entry.

Thanks again!

-greg
#26

[eluser]rc.griff[/eluser]
Has anyone come across any issues when redirecting? I keep getting the "headers already sent" warning after my validation completes and I try to redirect to another page. It seems to be stemming from the Recaptcha library:

Code:
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/.../application/libraries/Recaptcha.php:201)

Filename: libraries/Session.php

Line Number: 662
#27

[eluser]Greg Aker[/eluser]
check to make sure you don't have any white space below the closing php tags in your Recaptcha library. If you have a closing php tag, you can remove it.

-greg
#28

[eluser]rc.griff[/eluser]
Yup, that fixed it. I've come across something like that before. Any reason why that occurs?
#29

[eluser]JayTee[/eluser]
Hey guys! Thanks for helping out with this (Greg) I've been so swamped that this totally fell on the back burner.

I promise to take a look at this in the next few days and make sure it's updated.
#30

[eluser]rc.griff[/eluser]
Great library Jay, I found it very useful.




Theme © iAndrew 2016 - Forum software by © MyBB