0

I am trying to insert the captcha and button but is going to and continue to next page without verification Here is my html:

    <form method="POST">
<div class="g-recaptcha" data-sitekey="my site key"></div>
<button name="submit"></button>
</form>

Here is my attempt in php:

<?php 

if (isset($_POST['submit'])) {
$url='https://www.google.com/recaptcha/api/siteverify';
$privatekey='my key';
$response=file_get_contents($url.'?secret='.$privatekey.'&response='.$_POST['g-recaptcha-response'].'&remote'.$_SERVER['REMOTE_ADDR']);
$data=json_decode($response);
if (isset($data->success) AND $data==true) {
echo 'location:files/index.php';
}
}
 ?>
Tedinoz
  • 5,911
  • 3
  • 25
  • 35
BlockCode
  • 31
  • 1
  • 6

0 Answers0