登陆GG
https://www.google.com/recaptcha/admin/create
注册后
得到KEY
打开
http://code.google.com/p/recaptcha/downloads/list?q=label:phplib-Latest
下载获得 recaptchalib.php
存放到 source\module\member
打开文件 member_register.php
在 $ctl_obj = new register_ctl(); 上面加入
----------------
- require dirname(__FILE__).'/recaptchalib.php';
- $_G['py'] = '6LeW28oSAAAAAOk5iEV-TCR4m4RmWWYhWuML93zF';//你的密匙
- $_G['pky'] = '6LeW28oSAAAAANTyGmlYj69_WpWjud4uf-j017MW';//你的密匙
- $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[gp_action] == '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>
复制代码
|