我正在使用TYPO 3版本6.2.14。在此版本中,我使用Formhandler插件生成联系表。我已经实现了Google的自定义代码 reCAPTCHA V2显式渲染。现在,生成了reCAPTCHA代码。但是它没有执行服务器端验证。我还已经在fileadmin / templates / fromhandler / serversidevalidation.php中创建了用于服务器端验证的php文件
if(isset($_POST['g-recaptcha-response']))
{
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha){
echo '<h2>Please check the the captcha form.</h2>';
exit;
}
$secretKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$ip = $_SERVER['REMOTE_ADDR'];
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$captcha."&remoteip=".$ip);
$responseKeys = json_decode($response,true);
echo $responseKeys;
if(intval($responseKeys["success"]) !== 1) {
echo '<h2>You are spammer ! Get the bot out</h2>';
} else {
echo '<h2>Thanks for posting </h2>';
}
但是,这个简单的php文件不包含在TypoScript中。如何使用formhandler扩展实现服务器端验证。由于兼容性问题,我不想使用扩展名。有人可以引导我吗?