reCAPTCHA public key & private key - are you a human better solution!

Permalink 1 user found helpful
Hi,
with reCAPTCHA I don't get input fields for public key and private key in Dashboard / captcha (see attached screenshot), so I want to find a way to edit the special file, where these keys are stored in Concrete5, to put them in manually.
Can somebody please tell me, where these keys are stored?
Mike

1 Attachment

mike2013
View Replies: View Best Answer
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper
It looks like there is missing of php tag. So it displays the code in browser. How do you incorporate recaptcha?

Rony
mike2013 replied on at Permalink Reply
mike2013
Hi Rony,

I downloaded reCAPTCHA 1.1 from here:
https://github.com/concrete5/addon_recaptcha...
unpacked it into Packages, as any theme or add-on and installed normally.
I did this several times on latest english & german concrete5.

Mike
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper
You can have a try to uninstall & reinstall the package.
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper
Ohh! got it. Seems like your server doesn't support php short tag.

This is the original code
<?=$form->label('CAPTCHA_RECAPTCHA_PUBLIC_KEY', t('Public Key'))?>


Need to alter with this one

<?php $form->label('CAPTCHA_RECAPTCHA_PUBLIC_KEY', t('Public Key'))?>


Note: The <?= tag is being replaced with <?php tag. You need to do this for all of them. The path is ROOT\packages\recaptcha\elements\system\captcha\recaptcha\form.php

Rony
MoonGrab replied on at Permalink Reply
MoonGrab
Wrong.
<?= tag should be replaced with <?php echo and not with just <?php

Besides, this is not exactly a short tag, it is always available from PHP 5.3 onwards and will be available in PHP6, where short tags are being deprecated.

So search for "<?=" and replace it with "<?php echo ".

Also, this shouldn't be a problem in your case for plenty of reasons.
Can I have a live URL?
ronyDdeveloper replied on at Permalink Reply
ronyDdeveloper
You are right. I've missed out the echo. But I'm not sure about the version. Have you seen the attached screenshot? Its more likely it doesn't parse the tag. So if the server supports that tag, it should parse and display it properly.

Rony
MoonGrab replied on at Permalink Reply
MoonGrab
I was a bit lazy to check the PHP changelog.
It's a 5.4 change. So you should be right because most web hosts haven't yet implemented 5.4 for reasons like lacking the Suhosin patch and general compatibility issues.
mike2013 replied on at Permalink Reply
mike2013
> Can I have a live URL? <
The server is down at this moment, but when I'll be at home in about 3 hours, I'll start it.
mike2013 replied on at Permalink Reply
mike2013
> Ohh! got it. Seems like your server doesn't support php short tag.<

Hmm, I'm also running phpBB forum software for 8 months on this server, which does support reCAPTCHA!
Any ideas?
MoonGrab replied on at Permalink Best Answer Reply
MoonGrab
This is not related to reCAPTCHA but to the way it is displayed.

It's a small thing, really. If a piece of code begins with "<?=" instead of "<?php echo ", your server might misinterpret it and show it as plain text instead of executing it.
mike2013 replied on at Permalink Reply
mike2013
Thanks! I'll try it instantly, when I'm at home. :)
mike2013 replied on at Permalink Reply 1 Attachment
mike2013
So now after editing form.php, "<?=" is not found anywhere in concrete5 folder. :)
There must be another reason for reCAPTCHA behavior. :-/
mike2013 replied on at Permalink Reply 1 Attachment
mike2013
Nearly solved :)
Now I can put in keys, but cannot save them.
I get a window with:
saveConfig('CAPTCHA_RECAPTCHA_PUBLIC_KEY', $args['CAPTCHA_RECAPTCHA_PUBLIC_KEY']); $pkg->saveConfig('CAPTCHA_RECAPTCHA_PRIVATE_KEY', $args['CAPTCHA_RECAPTCHA_PRIVATE_KEY']); $pkg->saveConfig('CAPTCHA_RECAPTCHA_THEME', $args['CAPTCHA_RECAPTCHA_THEME']); } public function display() { $pkg = Package::getByHandle('recaptcha'); Loader::library('3rdparty/recaptchalib', 'recaptcha'); print ''; print ''; print recaptcha_get_html($pkg->config('CAPTCHA_RECAPTCHA_PUBLIC_KEY')); } public function label() { $form = Loader::helper('form'); print $form->label('captcha', t('Verify yourself.')); } public function showInput() {} public function check() { $pkg = Package::getByHandle('recaptcha'); Loader::library('3rdparty/recaptchalib', 'recaptcha'); $resp = recaptcha_check_answer($pkg->config('CAPTCHA_RECAPTCHA_PRIVATE_KEY'), $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"] ); return $resp->is_valid; } } Fatal error: Class 'RecaptchaSystemCaptchaTypeController' not found in /Library/WebServer/Documents/en/concrete/core/models/system/captcha/library.php on line 129

and the guestbook window looks like attachment.

Mike
JohntheFish replied on at Permalink Reply
JohntheFish
There are reCAPTCHA and 'Are You A Human' addons in the PRB at the moment. I believe both will be free.
mike2013 replied on at Permalink Reply
mike2013
Hmm, this thread IS about reCAPTCHA. :)
I'm using it already, but there are problems with my server (Mac), which I have to resolve - with this thread, I hope. :)
MoonGrab replied on at Permalink Reply 1 Attachment
MoonGrab
Here's the file you need.
Extract this file to your /packages/ directory.
It replaces one file (so yes, replace it when asked).

You missed a space after your "echo" command, so you had statements like echo$form->blabla instead of echo $form->blabla.
mike2013 replied on at Permalink Reply 1 Attachment
mike2013
Hmm, I still get errors like attachment:
And yes, I deleted cache in c5 and browser, before.
mike2013 replied on at Permalink Reply
mike2013
Maybe I could edit the destination file and put in personal and private key manually?
But I don't know, which file. :-/
mike2013 replied on at Permalink Reply 2 Attachments
mike2013
I have MY solution !!!

Many, many thanks to MoonGrab and ronyDdeveloper!
Especially MoonGrab spent much time on this problem!

So it's not reCAPTCHA - the solution is: Are You A Human!
And remember, I'm running concrete5.6.1.2 an a Mac mini with Mac OS X SERVER 10.6.8 Snow Leopard, Apache 2.2.22, PHP 5.3.15 and MySQL(i) 5.0.92.
So maybe it won't work on other systems.

As I didn't find a solution for captcha and then reCAPTCHA to work on my system, I installed "addon_are_you_a_human-master.zip" from here:
https://github.com/concrete5/addon_are_you_a_human...
When installing, I didn't succeed: no input for Publisher Key & Scoring Key. :(
So I tried the trick of MoonGrab and ronyDdeveloper and changed
"<?=" with "<?php echo " (without the ") in 2 files (install_post.php & form.php) several times and BINGO, this works!
When installing are_you_a_human, I got a message:
url('/dashboard/system/permissions/captcha/').'" target="_blank">'.t('captcha configuration').''; $docsLink = ''.t('documentation').''; $ayahLink = ''.t('Are You A Human').''; ?>
Are You Human
You installed the new captcha system. Go to the system to complete setup.

but nevertheless the installation DOES work!

Hope this will also help others. :)

Mike
keith2013 replied on at Permalink Reply
I'm having exactly the same error messages on my system - just finding my way around C5 - it's running on IIS8 on Windows8 in case it makes any difference.