最近實在是被機器人 煩到受不了 三天兩頭就來給我洗整面的廣告 遺憾的事情是 phpbb3 防禦實在是無效 已經被破解光了 只好加個 google 機器人驗證了
有點硬改 沒有依照 phpbb的玩法下去 就參考吧
打開 styles/prosilver/template/ucp_register.html 搜尋 <!-- INCLUDE {CAPTCHA_TEMPLATE} --> 後面添加 <div class="panel"> <div class="inner"> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cscript%20src%3D'https%3A%2F%2Fwww.google.com%2Frecaptcha%2Fapi.js'%3E%3C%2Fscript%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="<script>" title="<script>" /> <div class="g-recaptcha" data-sitekey="你的htmlkey"></div> </div> </div>
打開 includes/ucp/ucp_register.php 搜尋 if ($submit) { 後面添加 $recaptcha_secret = '你的私鑰'; $gRecaptchaResponse = request_var('g-recaptcha-response', ''); $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $recaptcha_secret . "&response=" . $gRecaptchaResponse); $response = json_decode($response, true); if ($response["success"] !== true) { echo 'google recaptcha error.'; exit; }
申請api方式: google reCAPTCHA 機器人驗證
參考文章:
https://phpbb-tw.net/phpbb/viewtopic.php?f=176&t=54145