. // recaptcha utilities // do not include the loader from somewhere else require('../inc/recaptcha_loader.php'); function boinc_recaptcha_get_head_extra() { // are we using recaptcha? $publickey = parse_config(get_config(), ""); if ($publickey) { // the meta tag must be included // for Recaptcha to work with some IE browsers return ' '; } else { return null; } } 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\SocketPost()); $resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']); return $resp->isSuccess(); } return true; } ?>