Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

ReCAPTCHA For DX1.5 Dx1.0 Dx 1.5RC

[复制链接]
friendliness 发表于 2010-11-21 10:24:02 | 显示全部楼层 |阅读模式
本帖最后由 friendliness 于 2010-11-21 10:42 编辑

適用版本: Disucz X1 Discuz X1.5 Discuz X1.5 RC
語言編碼: GBK  BIG5  UTF_TC  UTF_SC
插件作者: Friendliness ( 曾采楓 )
版權所屬: Friendliness ( 曾采楓 )
支持網站: http://test.globalasians.com
插件簡介:Google的 ReCAPTCHA驗證碼 For Discuz X1 Discuz X1.5 Discuz X1.5 RC。

先看效果:



參照原文:http://www.yookoala.idv.hk/en/node/24 僅支持 Discuz!6.0,修改後,使其在Dx1, Dx1.5, Dx1.5 RC 下使用。
具體做法 : 首先在http://www.google.com/recaptcha申請賬號,註冊你的網站,
                 獲取Public Key和Private Key, 到這裡下載recaptcha-php-1.11.

在/source/include文件夾下新建一個recaptcha文件夾,將下載的recaptchalib.php文件複製到該文件夾內。

打開/source/module/member/member_register.php文件

查找:
  1. $username = dhtmlspecialchars($username);
复制代码


在上面添加:
  1. // recaptcha hack start
  2. require_once DISCUZ_ROOT.'./source/include/recaptcha/recaptchalib.php';
  3. $recaptcha_publickey = '這裡替換為你申請到的Public Key';
  4. $recaptcha_show = recaptcha_get_html($recaptcha_publickey);
  5. // recaptcha hack end
复制代码
查找:
  1. $username = addslashes(trim(dstripslashes($username)));
复制代码
在上面添加:
  1. // recaptcha hack start
  2.         require_once DISCUZ_ROOT.'./source/include/recaptcha/recaptchalib.php';
  3.         $recaptcha_privatekey = '這裡替換為你申請到Private Key';
  4.         $resp = recaptcha_check_answer ($recaptcha_privatekey,
  5.                   $_SERVER["REMOTE_ADDR"],
  6.                   $_POST["recaptcha_challenge_field"],
  7.                   $_POST["recaptcha_response_field"]);
  8.         if (!$resp->is_valid) {
  9.           // What happens when the CAPTCHA was entered incorrectly
  10. if ($resp->error = 'incorrect-captcha-sol') {
  11. $resp->error = "驗證碼輸入不正確,請按"刷新"按鈕重新獲取驗證碼並再試一次。";
  12.         }
  13.           showmessage('reCAPTCHA failed. reCAPTCHA said: ' . trim($resp->error));
  14.         }
  15. // recaptcha hack end
复制代码
打開template/default/member/register.htm

查找:
  1. <p id="layer_reginfo_b" class="fsb cl">
  2.                         <!--{if $_G['setting']['sitemessage'][register]}-->
复制代码
在上面添加:
  1. <!--{if $recaptcha_show}-->
  2. <label>
  3. <script type="text/javascript">
  4. var RecaptchaOptions = {
  5. theme: 'custom',
  6. lang: 'en',
  7. callback: 'Recaptcha.focus_response_field',
  8. custom_theme_widget: 'recaptcha_widget',
  9. custom_translations: {
  10. play_again: "重播",
  11. cant_hear_this: "下載MP3"} };
  12. </script>
  13. <div id="recaptcha_widget" style="display:none">
  14. <div id="recaptcha_image"></div>
  15. <div class="recaptcha_only_if_incorrect_sol" style="color:red">輸入驗證碼錯誤,請重試一次。 </div>
  16. <span class="recaptcha_only_if_image">驗證碼:</span>
  17. <span class="recaptcha_only_if_audio">輸入您聽到數字:</span>  
  18. <input type="text" id="recaptcha_response_field" name="recaptcha_response_field" /> *
  19. <span><a href="javascript:Recaptcha.reload()">刷新</a></span>
  20. <span class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')">聲音</a></span>
  21. <span class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')">文字</a></span>
  22. <span><a href="javascript:Recaptcha.showhelp()">?</a></span>
  23. <p>$recaptcha_show</p>
  24. </label>
  25. <p style="color: blue;">提示: 為提高輸入驗證碼成功率,當您感到驗證碼辨識困難時,</p>
  26. <p style="color: blue;">請按上面的刷新按鈕重新獲取新的驗證碼,直到您滿意為止。 </p>
  27. <!--{/if}-->
复制代码
進入管理後台,全局——防灌水設置——驗證碼設置,取消新用戶註冊驗證;
界面——界面設置——啟用浮動窗口——取消註冊窗口浮動
更新緩存,OK。
如果你從未修改過註冊文件,直接用下載的文件覆蓋即可(請務必事先做好備份)。
不想自己改,用下面是修改好的文件,

免費下載:

评分

1

查看全部评分

回复

使用道具 举报

wambb110 发表于 2010-11-21 10:33:53 | 显示全部楼层
这个是干什么的 ?

回复

使用道具 举报

stcv66 发表于 2010-11-21 10:34:53 | 显示全部楼层
什么东西啊!
回复

使用道具 举报

wambb110 发表于 2010-11-21 10:35:43 | 显示全部楼层
也没什么介绍啊 真晕
回复

使用道具 举报

 楼主| friendliness 发表于 2010-11-21 10:48:40 | 显示全部楼层
多謝支持

預告其他插件: Facebook 绑定账号 For Discuz X 1.5 和 虛擬形像 For Discuz X1.5 ( 正測試中)
回复

使用道具 举报

li79830517 发表于 2010-11-21 10:55:44 | 显示全部楼层
直接用下載的文件覆蓋即可
回复

使用道具 举报

 楼主| friendliness 发表于 2010-11-21 10:57:54 | 显示全部楼层
Yes (EM:131:)
回复

使用道具 举报

marco129 发表于 2010-11-21 11:03:33 | 显示全部楼层
回复

使用道具 举报

ilei365 发表于 2010-11-21 11:13:34 | 显示全部楼层
没什么介绍啊
回复

使用道具 举报

 楼主| friendliness 发表于 2010-11-21 11:23:50 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-8-23 22:58 , Processed in 0.137186 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表