ReCAPTCHA library - ignited |
[eluser]JayTee[/eluser]
FYI - I've updated the code. Here's the current feature list: * Works in CI 1.7.x * Uses config file for saving your reCaptcha keys and theme * Uses an editable view for the reCaptcha form that can be inserted anywhere in your code * Logs errors and messages to your log files rather than to the user’s screen * Multilingual support. Check http://recaptcha.net/apidocs/captcha/client.html for supported languages and codes. English is the only language included (other language contributions welcome) * Uploaded needed files as a zip rather than copy/paste from the wiki * Download includes a sample that only requires you to include your API Keys from recaptcha.net Check out the Wiki and let me know what you think http://codeigniter.com/wiki/ReCAPTCHA/
[eluser]metamorpher[/eluser]
I can't apply my own theme using the 'custom' direction
[eluser]JayTee[/eluser]
There's more to the "custom" theme than what I have in this library - I'd have to add additional functionality to accommodate that. I'll get back to you
[eluser]cellulit[/eluser]
Guys; I feel numb. really. It seems to be so easy to incorporate recaptcha using this excellent library and I'm failing :\ Basically, I can't get the code validated. I can generate it, it gets validated against "required" condition, but not against the custom validation rule. Actually it always gets validated and returns "true". Any ideas? the part of the controller... Code: // processing the registration form By the way... Why there's $val variable used in the custom function? I can't see it passed in the validation rules (in a demo file). Thanks in advance!
[eluser]cellulit[/eluser]
You know what... I just got it. Right after I posted the code :cheese: "captcha_check" (rules) vs. "check_captcha" (the function). ugh... Thanks anyway!
[eluser]mr_coffee[/eluser]
This worked perfect for me (the new one) after making a couple of adjustments, though I see how this would be a special case. The previous comment tipped me off. The form_validation config file was not working as advertised for me, but it's how I have the controller set up: Code: function index($recipient) { == fail. I tried variations on the config file but couldn't make it work (even when I knew the value of $recipient). The following adjustment was sufficient (adding this to the controller): Code: $this->form_validation->set_rules('recaptcha_response_field','lang:recaptcha_field_name','required|callback_check_captcha'); As I also like to sort things of this nature into folder - specifically one labeled 'forms' - I was surprised to find that placing the recaptcha.php view in the forms folder failed until I figured out its name and location was set in the recaptcha.php library file... should be line 158: Code: return $this->_CI->load->view('forms/recaptcha',$html_data,TRUE); Ok, back to my controller implementation: I'd decided to create a single controller to deal with e-mail for multiple accounts. Therefore 'email/name' as an address generates the appropriate form. All sorts of goofy things happen in the controller... variables set up for the page view... if there's a phone number they want displayed, etc... it all gets dumped into the form view. The generic example assumes - at least I think it does - that the controller would only ever display the form, and that it's the "only" form. As this was not true in my case, I also had to make this adjustment to the form view: Code: <?php echo form_open('contact/'.$contactpage,array('class' => 'emailForm')); ?> $contactpage is the same as $recipient... but just being the data variable name I passed to the view. 'contact' is the name of the view (contact.php). The way I have CI set up in general... as I have a main controller dealing with everything (:any)... if the address is not found, it goes home. I have to specify the address of the form or you'd never see the errors if there were any. The class is in there just so I could style the placement of the labels and images. The only suck part is that the final code will fail xhtml validation as there is a script in the body of the page. It might be possible to make an adjustment using the reCaptcha API and having a predetermined div where the table will be written to, but I haven't tried it. The error is kind of worth it to curtail spam, on the other hand. I've read through the comments here. To the neigh-sayers: the old "captcha" method was not very good. reCaptcha - on the other hand - IS very good. It isn't an "end all" to spam, but it's very effective. I had the old version installed to a forum and still got at least one SPAM sign up per week... and since switching to the reCaptcha verification method: have only had one in a year. I'd wager that user had to manually read the image and sign up with their spam URL in their profile... and if a spammer is willing to go through all THAT trouble... they deserved the ability to sign up even if I did ban their IP after. While the forum isn't advertised or anything... I'd call that a pretty decent reason to use the reCaptcha method: it is quite effective. My thanks to the author of the library!
[eluser]BaSi[/eluser]
Hi everybody, and first of all sorry for my english :down: I'm tryin to integrate reCaptcha in a form. I'm having a problem I' can't solve after being reading and googleing, here and there, for several days. This is my first application in CI. The lib recaptcha is loaded in the controller, but de view doesn't recognize the variables from recaptcha config. All the rest of validations are working ok. Here are the codes: contact.php Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); I'll continue in another post...
[eluser]BaSi[/eluser]
contactview.php Code: <div id = "main"> Code: <?php I don't know where is the error, and thanks in advance for the replies.
[eluser]Brennan Novak[/eluser]
Excellent little library. I had a bit of a hard time getting it work at first. The error that kept coming up was: Severity: Warning Message: include_once(application/config/recaptcha.php) [function.include-once]: failed to open stream: No such file or directory Filename: libraries/Loader.php Line Number: 869 Numerous threads in here led me down wrong paths. The problem turned out to be simple file permissions of the config, library, and controller files that were added. So, make sure the permissions are correct on your testing and dev servers. |
Welcome Guest, Not a member yet? Register Sign In |