有人编辑formtoemailpro
使用Recaptcha v2吗?这是formtoemailpro
开发人员版本,它为您提供了一个PHP脚本:(https://formtoemail.com/developer_pricing.php)
我尝试过更改
// Check reCAPTCHA
if($reCAPTCHA)
{
require_once('recaptchalib.php');
$resp = recaptcha_check_answer($privatekey,$_SERVER["REMOTE_ADDR"],$_REQUEST["recaptcha_challenge_field"],$_REQUEST["recaptcha_response_field"]);
if(!$resp->is_valid)
{
$errors[] = "The reCAPTCHA wasn't entered correctly. Go back and try it again (reCAPTCHA said: " . $resp->error . ")";
}
unset($_REQUEST["recaptcha_challenge_field"]);
unset($_REQUEST["recaptcha_response_field"]);
}
到
// Check reCAPTCHA
if($reCAPTCHA)
{
//require_once('recaptchalib.php');
//$resp = recaptcha_check_answer($privatekey,$_SERVER["REMOTE_ADDR"],$_REQUEST["recaptcha_challenge_field"],$_REQUEST["recaptcha_response_field"]);
$resp = recaptcha_check_answer($privatekey,$_SERVER["REMOTE_ADDR"],$_REQUEST["g-recaptcha-response"]);
if(!$resp->is_valid)
{
$errors[] = "The reCAPTCHA wasn't entered correctly. Go back and try it again (reCAPTCHA said: " . $resp->error . ")";
}
unset($_REQUEST["g-recaptcha-response"]);
}
但是有错误。
This page isn’t working
webeg.uk is currently unable to handle this request.
测试时间为http://webeg.uk/aaq/
有人能指出我正确的方向吗?
答案 0 :(得分:0)
我想我有一个解决方案,请随意测试和批评:
如上所述,在formtoemailpro中替换现有的reCaptcha行,请输入以下内容:
// Check reCAPTCHA
if($reCAPTCHA)
{
if(isset($_REQUEST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha){
echo '<h2>Please check the the captcha form.</h2>';
exit;
}
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$privatekey&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
if($response.success==true)
{
unset($_REQUEST['g-recaptcha-response']);
}
}
谢谢