recaptcha_get_html($pub); $lang = $GLOBALS["PHORUM"]["DATA"]["LANG"]["mod_spamhurdles"]; return array( "question" => 'not used', "answer" => 'not used', "input_fieldname" => 'not used', "spoken_text" => 'not used', "html_form" => $html_form, "html_after_form" => '', "error" => $lang["CaptchaWrongCode"], ); } function check_answer($info) { header("Access-Control-Allow-Origin: https://www.google.com"); $conf = $GLOBALS["PHORUM"]["mod_spamhurdles"]["captcha"]; $prv = empty($conf['recaptcha_prvkey']) ? '' : $conf['recaptcha_prvkey']; $url = 'https://www.google.com/recaptcha/api/siteverify'; $data = ['secret' => $prv, 'response' => $_POST['g-recaptcha-response'], 'remoteip' => $_SERVER['REMOTE_ADDR']]; $options = [ 'http' => [ 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data) ] ]; $context = stream_context_create($options); $result = file_get_contents($url, false, $context); if ( json_decode($result)->success == false ) { return $info['error']; } return NULL; } function recaptcha_get_html($pubkey) { if ($pubkey == null || $pubkey == '') { die ("To use reCAPTCHA you must get an API key from http://recaptcha.net/api/getkey"); } return '
'; } } ?>