Hi everyone,
i need your help, i have chronoform v4 and i would not like to update it ...
In my form in the "Preview" field I entered "Custom Item" which contains:
But it does not work.
Can you help me please?
i need your help, i have chronoform v4 and i would not like to update it ...
In my form in the "Preview" field I entered "Custom Item" which contains:
<script src="https://www.google.com/recaptcha/api.js?hl=it" async defer></script><body><form action="?" method="POST"><div class="g-recaptcha" data-sitekey="MYWEBSITEKEY"></div><br/><b>*Dati obbligatori</b><br/><br/><input name="submit" class="" value="Invia" type="submit" /></form></body></html>And in "Event" in "On Submit" the "Custom server side validation" function which contains:
<?php// Checks if form has been submittedif ($_SERVER['REQUEST_METHOD'] == 'POST') { function post_captcha($user_response) { $fields_string = ''; $fields = array( 'secret' => 'MYSECRETKEY', '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 { echo 'success'; }}?>And "In case of error" I entered "Event Loop".
But it does not work.
Can you help me please?