close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

How to install Google reCHAPTCHAv2 on the form?

Thread began 6/13/2018 5:05 am by rikaG_510 | Last modified 6/15/2018 10:26 am by Ray Borduin | 1228 views | 5 replies |

rikaG_510

How to install Google reCHAPTCHAv2 on the form?

Hi,

I’m having a hard time to install Google’s reCAPTCHA V2 on my form page I made with UE. On front end first 2-steps (java script pasting within header, adding a line with the public key) were all done. The problem is the last one; server side setting.

I can't write codes so I searched for something useful and found this.
Do you think this can be used as a part of form I made with UE?

<?php
// Checks if form has been submitted
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
function post_captcha($user_response) {
$fields_string = '';
$fields = array(
'secret' => 'secret-kkkkkkkeeeeeeeyyyyy',
'response' => $user_response
);
foreach($fields as $key=>$value)
$fields_string .= $key . '=' . $value . '&';
$fields_string = rtrim($fields_string, '&');

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.google.com/recaptcha/api/siteverify');
curl_setopt($ch, CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, True);

$result = curl_exec($ch);
curl_close($ch);

return json_decode($result, true);
}

// Call the function post_captcha
$res = post_captcha($_POST['g-recaptcha-response']);

if (!$res['success']) {
// What happens when the CAPTCHA wasn't checked
echo '<p>Please go back and make sure you check the security CAPTCHA box.</p><br>';
} else {
// If CAPTCHA is successfully completed...

// Paste mail function or whatever else you want to happen here!
echo '<br><p>CAPTCHA was completed successfully!</p><br>';
}
} else { ?>


I am wondering if I can just paste what UE generates to send email where it says “ // Paste mail function or whatever else you want to happen here!” But I guess it’s not that simple…
I read Google’s documents about this but I know too little to understand.

Any help will be appreciated :-)
I attached the form file and UE file.

Thank you so much for your help,
Rika

Sign in to reply to this post

Ray BorduinWebAssist

You should be able to just add the email code into that location.

Sign in to reply to this post
Did this help? Tips are appreciated...

rikaG_510

Hi Ray,

Thank you.
So I pasted it. Does this look alright? I mean it's not working so something must be going wrong.
Not working means reCAPTCHA is working but Submit doesn't do anything.

http://www.swiftinternational.biz/ROWING/rw_19-test.php

Any advise will be nice.
Thank you so much for your help.
Rika

Sign in to reply to this post

Ray BorduinWebAssist

I think you should have added the captcha code to the rw_19-test.php page, not the other one.

Sign in to reply to this post
Did this help? Tips are appreciated...

rikaG_510

Hi Ray,
Ok so I moved the code to rw_19-test.php, but I'm not 100% sure what email code I should paste there.
I pasted what's on waue_rw_19_3.php, obviously it's not working (blank page when files uploaded).

What will be the connection with waue_rw_19_3.php and what code am I adding after “ // If CAPTCHA is successfully completed...” ?

Sign in to reply to this post

Ray BorduinWebAssist

Lines 24-110 send the email and should be moved inside the conditional region where the recaptcha has been confirmed. This is something I could help with in a premier support ticket if you get stuck.

Sign in to reply to this post
Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...