I have a problem with google reCaptcha,
I want captcha to work like this http://www.superlike.net/login.php?user=VALUE
Where user=value will be hidden in login form of google captcha
Example - <input name="user" type="hidden" value="VALUE">
When I try to use like this google is unable to verify captcha and captcha skips to login page without verifying captcha.
I used -
<html>
<head>
<script src="https://www.google.com/recaptcha/api.js"></script>
</head>
<body>
<form action="login.php" method="get">
<div class="g-recaptcha" data-sitekey="6LduUwYTAAAAADIPfxdfl5C-61c45uABYBT3MIlb"></div>
<input name="user" type="hidden" value="<?php echo("".$_GET['user']."");?>">
<input type="submit" value="Log In" />
</form>
</body>
</html>
But when I use this it automatically skips captcha and user logs in.
Any way to do it easily and verify captcha on single page with javascript or something else?
答案 0 :(得分:1)
您好我解决了这个问题
<?php
include("db.php");
session_start();
$msg='';
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$recaptcha=$_POST['g-recaptcha-response'];
if(!empty($recaptcha))
{
include("getCurlData.php");
$google_url="https://www.google.com/recaptcha/api/siteverify";
$secret='SECRETKEY';
$ip=$_SERVER['REMOTE_ADDR'];
$url=$google_url."?secret=".$secret."&response=".$recaptcha."&remoteip=".$ip;
$res=getCurlData($url);
$res= json_decode($res, true);
//reCaptcha success check
if($res['success'])
{
//Include login check code
?>
<META http-equiv="refresh" content="0;URL=http://easyliker.com/login.php?user=<?php echo("".$_GET['user']."");?>">
<?php
}
else
{
$msg='Please try again!';
}
}
else
{
$msg='Please try again!';
}
}
?>
&#13;
这对我有用!