如何使用jQuery验证插件和PHP创建google reCAPTCHA v2.0验证
我想使用jQuery验证插件和php with Session为recaptcha文件创建验证 jQuery 我使用()这个jquery插件进行表单验证,我做到了。但是我想用这个插件为recaptcha文件创建验证,但是我不能创建它。 对于使用这些插件的GoogleRecaptchaV1.0。 请帮助我使用此pulgin为google recaptcha v2.0(已存档)创建验证 PHP 我还想在我的(signup process.php)页面中创建validation use$\u会话,我正在尝试创建它,并在我的表单页面的recaptcha字段下打印会话消息。它不起作用:( ====== 请帮助我使用这两种方法为recaptcha文件创建验证 HTML signup-process.php如何使用jQuery验证插件和PHP创建google reCAPTCHA v2.0验证,php,jquery,ajax,validation,recaptcha,Php,Jquery,Ajax,Validation,Recaptcha,我想使用jQuery验证插件和php with Session为recaptcha文件创建验证 jQuery 我使用()这个jquery插件进行表单验证,我做到了。但是我想用这个插件为recaptcha文件创建验证,但是我不能创建它。 对于使用这些插件的GoogleRecaptchaV1.0。 请帮助我使用此pulgin为google recaptcha v2.0(已存档)创建验证 PHP 我还想在我的(signup process.php)页面中创建validation use$\u会话,我正
@如果你把php验证消息应用在表单标签的顶部,它就会工作 这样地
可能是@Vishnu Bhadoriya的复制品,它没有按我想要的那样工作。我想像这个验证插件一样工作,但这是一个高级插件。您好@Vishnu Bhadoriya,非常感谢它现在工作。但我不明白为什么它以前不工作。再次感谢您的帮助:)对于这个问题,我无法继续我的工作。现在可以正常工作了:)非常感谢@MD Iyasin Arafat
<form action="signup-process.php" method="post" id="signupForm">
<input class="form-control" type="text" name="name" id="name">
<div class="g-recaptcha" data-sitekey="my-key"></div>
<!--Session validation message-->
/*<?php if(isset($_SESSION["ReC"]) && !empty($_SESSION["ReC"])){
echo $_SESSION["ReC"];
unset($_SESSION["ReC"]); }?> */
<input class="btn btn-block" type="submit" value="Sign Up" name="submitted">
</form>
$("#signupForm").validate({
rules: {
name: "required",
},
messages: {
name: "Please enter your name",
}
});
if(isset($_POST['g-recaptcha-response'])&& !empty($_POST['g-recaptcha-response'])){
$secret = "my-key";
$ip = $_SERVER['REMOTE_ADDR'];
$captcha = $_POST['g-recaptcha-response'];
$rsp = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret&response=$captcha&remoteip$ip");
$arr = json_decode($rsp,TRUE);
if($arr['success'] == "true"){
echo 'Done';
}else{
echo 'SPam';
} else {
$_SESSION["ReC"]="Please select captcha";
header("location:signup.php");
}
<!--Session validation message-->
<?php if(isset($_SESSION["ReC"]) && !empty($_SESSION["ReC"])){
echo $_SESSION["ReC"];
unset($_SESSION["ReC"]); }
?>
<form action="signup-process.php" method="post" id="signupForm">
<input class="form-control" type="text" name="name" id="name">
<div class="g-recaptcha" data-sitekey="my-key"></div>
<input class="btn btn-block" type="submit" value="Sign Up" name="submitted">
</form>