註冊頁加入 Google reCAPTCHA 驗證碼
於 reCAPTCHA 網頁註冊並取得 Public Key 及 Private Key.https://www.google.com/recaptcha/admin/create
下載附件 recaptchalib.php 並放到 source\module\member
打開文件 member_register.php
在 $ctl_obj = new register_ctl();上面加require dirname(__FILE__).'/recaptchalib.php';
$_G['py'] = '你的密匙';//Public Key
$_G['pky'] = '你的密匙';//Private Key
$resp = null;
$error = null;
$pass = $_G['gp_password'] ? $_G['gp_password']:$_G['gp_'.$_G['setting']['reginput']['password']];
if ($pass && !$_POST["recaptcha_response_field"]){
showmessage('警告!沒有輸入驗證碼');
}
elseif($pass && $_POST["recaptcha_response_field"]){
$resp = recaptcha_check_answer ($_G['pky'],
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
showmessage('驗證碼輸入錯了');
}
}打開 template\default\member\register.htm
於<!--{/if}-->
<!--{if $_G == 'activation'}-->
<div id="activation_user" class="rfm">上面添加 <div class="rfm">
<table>
<tr>
<th><span class="rq">*</span></th>
<td>{eval echo recaptcha_get_html($_G['py'])}</td>
<td class="tipcol"></td>
</tr>
</table>
</div> 管理員你好
請問那google也從傳統形式改為點擊"我不是機器人"形式
該方法及代碼是否依然適用呢?
頁:
[1]