This commit is contained in:
2020-11-03 14:09:15 -05:00
parent 23a4737de3
commit f4adc4ab3d
2 changed files with 54 additions and 1 deletions
+22 -1
View File
@@ -18,7 +18,28 @@ class Contact extends CI_Controller {
extract($_POST);
if ($_POST) {
$resp = $this->input->post('h-captcha-response');
$secret = "0x608809f0227f7FA577E069524805cC25f5E732C0";
$url = "https://hcaptcha.com/siteverify";
$data = array(
"secret" => $secret,
"response" => $resp
);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($data));
curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE);
$result = curl_exec($ch);
curl_close($ch);
$captcha = json_decode($result,true);
if (is_array($captcha) && array_key_exists("success",$captcha) && $captcha["success"]) {
// Ok
$message = '';
} else {
$message = 'Please verify that you are human';
}
$email = $this->input->post('email');
$firstname = $this->input->post('firstname');
$lastname = $this->input->post('lastname');