hCaptcha
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user