[英]Google ReCAPTCHA setting v2
我有google reCaptcha v2
的表格 。 但是在我的代码中,当人们没有选中图标I'm not a robot
,代码会将人们发送到带有消息Please check the the captcha form
的新页面。
我需要有人不检查图标I'm not a robot
,他/她与以下信息停留在同一页面上: Please check the the captcha form
。 这是我想要的一个例子
我有联系方式(姓名,电话和短信)
<?php
$email;$comment;$captcha;
if(isset($_POST['email'])){
$email=$_POST['email'];
}if(isset($_POST['comment'])){
$email=$_POST['comment'];
}if(isset($_POST['g-recaptcha-response'])){
$captcha=$_POST['g-recaptcha-response'];
}
if(!$captcha){
echo '<h2>Please check the the captcha form.</h2>';
exit;
}
$secretKey = "************";
$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);
if(intval($responseKeys["success"]) !== 1) {
echo '<h2>You are spammer ! Get the @$%K out</h2>';
} else {
echo '<h2>Thanks for posting comment.</h2>';
}
你能帮我吗?
我认为您应该使用#Javascript来验证客户端是否已经首先检查了验证码。 然后在提交验证码后发送提交表单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.