これは私のコードです、私は現在働いています。あなたがにリダイレクトしたいものは何でもページに設定$のURLでsuccesfullの後にリダイレクトGoogle recapta
echo '<script type="text/javascript">',
'location.replace("'.$url.'");'
,'</script>';
:しかし、私は唯一の「成功しましログに記録されて」、使用をecho'ingの
<title></title>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
<form method="post" action="index.php">
<div class="g-recaptcha" data-sitekey="xxxxx"></div>
<input type="submit" />
</form>
</body>
<?php
if($_SERVER["REQUEST_METHOD"] === "POST")
{
//form submitted
//check if other form details are correct
//verify captcha
$recaptcha_secret = "xxxxxxxxxg";
$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret."&response=".$_POST['g-recaptcha-response']);
$response = json_decode($response, true);
if($response["success"] === true)
{
echo "Logged In Successfully";
}
else
{
echo "You are a robot";
}
}
?>
ok、thats great、thats we want to what? – nogad
@Irfan Aliコードを投稿すると、コード全体を記述するのではなく、問題を解決するために役立ちます。コードを投稿して、 "編集"リンクをクリックして質問しますか?これは秘密にしておき、あなただけが知っているはずなので、秘密/秘密鍵を別のものに置き換えてください。 – jagb
@jabg私はそれを親切にチェックしました –