View Thread
 Print Thread
Google reCAPTCHA v2 API
skpacman
Will someone please try to sign up at my site just for basic testing? I think I have it working perfectly.

Once it's tested on my site, I'll release it.

Edit: Beta file can be found at: [ REDACTED ]

I've implemented this here and works OK. Someone else please try on their site. From the link above, click on the .zip and click on the download icon at the top of the page and the install instructions are pretty simple from there. I'll fill out the documentation and stuff soon.

It'll be submitted to main here soon too.

Edit2: Removed download link. That version is broken. A new one will be available soon.
Edited by skpacman on 01-15-2015 13:51

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
http://www.skpacman.com
KasteR
I'm going to upload this to my dev site and test it out now. I registered on your site, and have not received an activation e-mail yet. Not sure if you configured that portion on your dev site.
 
http://kaster.us
skpacman
Oh, forgot to ask.. How did you disable the Register button until they were verified as a human??? I need to implement that...

Also, you may need to re-upload your register.php (or whatever you modified). The addon requires you to have unmodified core files.... (as it should)

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
http://www.skpacman.com
KasteR
For the button disabling, I setup a jQuery callback function. On the jQuery ready function add the attribute 'disabled' to have it disabled by default. The callback just removes that attribute via jQuery. But it's not solid..a bot will emulate the submission most likely anyways.


add_to_footer("
     
    
");


Edit:
Also, I could pop that function in there if you get stuck. Or run out of time. Let me know, sorry I know I was kinda vague in my last response to your question.
Edited by KasteR on 01-14-2015 16:44
 
http://kaster.us
skpacman
Did you enable it on your site? Are you using a proper key?
Old v1 keys will render the v2 reCAPTCHA with the v1 API (i think) so make sure you get new keys if you are going to enable it.

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
http://www.skpacman.com
KasteR
My fault, I had mistakenly set the wrong option for the captcha type. I mistakenly set it as captcha, when it should have been grecaptcha.

I am having an issue however. I haven't explored as to why yet. For some reason the site key is not working properly. First things I will explain, I have not modified the core register.php file at all. The site key is being stored into the database, I confirmed that. Also, my site key is up to date. I got new keys when I originally started messing around with this recently.

I think the issue may have to do with recaptchalib.php. The function ReCaptcha specifically. I'll check it out in a bit, unless you want to in the mean time. Here's the error I receive:

Quote

Register

Fatal error: Class 'ReCaptcha' not found in /home/u477835693/public_html/includes/captchas/grecaptcha/functions.php on line 27
 
http://kaster.us
skpacman
That's odd... I'm going to try a fresh install here and see if mine does the same. It's acting like it didnt read the recaptchalib.php even though it's required...

Re-installed and worked fine here. No idea why it would cause that specific issue if it works elsewhere...

I'll clean some stuff up and you can try again.

Just a random thought, though... try changing /includes/captchas/grecaptcha/functions.php line 24 to:

require_once INCLUDES."captchas/grecaptcha/recaptchalib.php";
and see what happens
Edited by skpacman on 01-15-2015 13:14

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
http://www.skpacman.com
skpacman
I'm making some improvements in the infuse/defuse system and researching why yours won't read the class correctly. No idea why. Works fine on everything I'm using.

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
http://www.skpacman.com
KasteR
Problem solved. That's exactly what the issue was. You would think that you wouldn't need to be so specific with the path. Either way, that was it.

I tested with 2 new registrations. First was without completing the captcha, and it failed as it should. Second was completing the captcha, and it passed as it should. Good job man Thumb Uprock
 
http://kaster.us
skpacman
I updated the infuse/defuse script. It's a bit smarter now.
I've also added the callback in my own way. Looks good.
Added a setting for light/dark theme (i didnt know that existed until you posted code lol)
I'll button it up tomorrow (locale, readme, etc..) and release another one for testing. Google Drive screwed up my release process so I'm going back to GitHub for now... Gah!

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
http://www.skpacman.com
NetriX
It would be a good idea to give the option or detail on changing the language code for our good friends with different languages.

https://developer...s/language
Need help? Having trouble?
» View our Documentation for guides, functions and more - including the [url=https://php-fusion.co.uk/articles.php?cat_
 
https://netrixhosting.com
KasteR
Maybe in the infusions panel, add a combo box listing these languages. Also displaying a link to that page. Create a new column in the table, maybe call it 'language'. Then store the value in the database, from user selection. Also update infusion.php to include a default value.

Then add a parameter to the JavaScript include, located in functions.php.

original

add_to_head(""); //Make sure the API is loaded properly everywhere this functions is included

proposed

add_to_footer(""); //Make sure the API is loaded properly everywhere this functions is included


And actually, for JavaScript, I ususally use add_to_footer, instead of add_to_head. For CSS I'll use add_to_head, but JavaScript is better placed last in my opinion. For optimization.
 
http://kaster.us
skpacman
I've already moved js to footer.

If not set, the google api detects the language on a per-browser basis so the only reason to set it is if you want to lock it to one language.

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
http://www.skpacman.com
KasteR
That's good to know. Makes sense to work that way. Thumb Up
 
http://kaster.us
skpacman
Uploaded latest to github: https://github.co...I-Infusion

Please test. Defuse the old one first, replace all files then infuse the new one.

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
http://www.skpacman.com
KasteR
I'll try to this weekend, for sure by Monday. I noticed the captcha appears for the contact form too Thumb Up
 
http://kaster.us
KasteR
A couple of things I'm looking at right now are
Register submit button is disabled, but perhaps the target text should be like this:

captcha_display.php

$('input[type=\"submit\"]:input[value=".$locale['global_107']."]').attr('disabled','disabled');


As opposed to:

$('input[type=\"submit\"]:input[value=\"Register\"]').attr('disabled','disabled');


Also, previously I had mentioned how this does get included on the contact.php file, so we should target the submit button for this form as well. Here's the entire add_to_footer portion, with my suggestions:


add_to_footer("");


Another thing I'm looking into is doing something about session expiration.. On session expire, the buttons should become disabled once again.

Minor typo found in the header portion of the documents.

Original:

Quote

| PHP-Fusion using the built-in PHP-Fusino captcha system

Change to:

Quote

| PHP-Fusion using the built-in PHP-Fusion captcha system


Other than that, everything looks good. Honestly it is working. The things I've mentioned would are just nice to have. I'll try to resolve a way to the session expiration part. Just an addtional condition to account for before $_CAPTCHA_IS_VALID = true.
 
http://kaster.us
skpacman
adding those to my list and I'll have 0.0.3a out on GitHub in the next couple days.

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
http://www.skpacman.com
skpacman
0.0.3a now available on GitHub

There are 10 kinds of people in this world.
Those who understand binary,
and those who don't...
 
http://www.skpacman.com
KasteR
Awesome, I'll check it out tomorrow. I stayed home from work today, not feeling too well.
 
http://kaster.us
Jump to Forum
Similar Threads
Thread Forum Replies Last Post
reCAPTCHA v3 [7.02.XX] Other / Integrations / Images 1 12-23-2018 19:40
[GUIDE] Speedup Google Chrome General Chat 1 06-08-2015 22:29
Google Adsense help General Chat 3 04-12-2015 20:08
PHP-Fusion Google Chrome Theme Graphics Talk 5 03-22-2013 06:59
Google+ Sign-In General Chat 6 02-26-2013 13:14