Advertisement
Suwandiaminsangaji

cek.php

Jul 4th, 2021
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.10 KB | None | 0 0
  1. <!-- 6LeQGW4bAAAAAIpTF2g3nP08M9G-bd_3NoDDEdop -->
  2. <?php
  3. // Secret Key ini kita ambil dari halaman Google reCaptcha
  4. // Sesuai pada catatan saya di STEP 1 nomor 6
  5. $secret_key = "6LeQGW4bAAAAAIpTF2g3nP08M9G-bd_3NoDDEdop";
  6. // Disini kita akan melakukan komunkasi dengan google recpatcha
  7. // dengan mengirimkan scret key dan hasil dari response recaptcha nya
  8. $verify = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret_key.'&response='.$_POST['g-recaptcha-response']);
  9. $response = json_decode($verify);
  10.  
  11.  
  12. if($response->success){ // Jika proses validasi captcha berhasil
  13.   echo "<h2>Captcha Valid</h2>";
  14.   echo "Yes, you're human (Anda adalah manusia)<hr>";
  15.   echo "<b>Nama :</b><br>".$_POST['nama']."<br><br>";
  16.   echo "<b>Email :</b><br>".$_POST['email']."<br><br>";
  17.   echo "<b>Komentar :</b><br>".$_POST['komentar']."<br><br>";
  18. }else{ // Jika captcha tidak valid
  19.   echo "<h2>Captcha Tidak Valid</h2>";
  20.   echo "Ohh sorry, you're not human (Anda bukan manusia)<hr>";
  21.   echo "Silahkan klik kotak I'm not robot (reCaptcha) untuk verifikasi";
  22.   header('location:chaptca.php');
  23. }
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement