STEP II
段代接到站<head>面
1.勾我不是械人


- // GOOGLE RECAPTHA
- $data['secret'] = '私';
- $data['response'] = $_POST['g-recaptcha-response'];
- $ch = curl_init();
- // 利用CURL
- curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,0);
- curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,0);
- curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_URL, 'https://www.google.com/recaptcha/api/siteverify');
- curl_setopt($ch, CURLOPT_POST, true;
- curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
- $result = curl_exec($ch);
- curl_close($ch);
- // 解密
- $result = json_decode($result, true);
-
- // 查是否通
- if ( ! isset($result['success']) || ! $result['success']) {
- // 失
- echo "<script>alert('械人失!');history.go(-1);</script>";
- exit;
- }
代 - <!-- Google reCAPTCHA -->
- <script src="https://www.google.com/recaptcha/api.js?Onload=onloadCallback2&render=explicit" async></script>
- <script>
- var onloadCallback2 = function() {
- grecaptcha.render("recaptcha_box2", {
- /* Change Your sitekey */
- "sitekey": "公",
- "callback": callback2
- });
- };
-
- function callback2() {
- /* 可行提交表的作
- alert("恭喜你成功");
- */
- document.getElementById("submit2").disabled = false;
- document.getElementById("submit2").classList.remove('au-btn--gray');
- document.getElementById("submit2").classList.add('au-btn--yellow');
- }
- </script>
代 如果已,想查自己的公私:
https://www.google.com/recaptcha/admin#list
的,下面三步Google reCAPTCHA~
前去 Google械人官,右上的 「Admin console」按。


然後在form的action程式面上使用function ,如果false就不登入,就可以啦~
STEP III


PHP版
查立好的公私: https://www.google.com/recaptcha/admin/site/350731086/settings
文章出
下方是到要示的位置
STEP I
填入名、型、域、管理者,成Google集、建立
- <div id="recaptcha_box2"></div>
代 文章定位: