. // recaptcha utilities // do not include the loader from somewhere else require('../inc/recaptcha_loader.php'); function boinc_recaptcha_get_head_extra() { global $recaptcha_public_key; if ($recaptcha_public_key) { return ' '; } return ""; } function boinc_recaptcha_get_html($publickey) { if ($publickey) { return '
'; } else { return ''; } } // wrapper for ReCaptcha implementation // returns true if the captcha was correct or no $privatekey was supplied // everything else means there was an error verifying the captcha // function boinc_recaptcha_isValidated($privatekey) { if ($privatekey) { // tells ReCaptcha to use fsockopen() instead of get_file_contents() $recaptcha = new \ReCaptcha\ReCaptcha($privatekey, new \ReCaptcha\RequestMethod\CurlPost()); $resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']); return $resp->isSuccess(); } return true; } ?>