Google的reCAPTCHA验证码 for DZX1.0和1.5。
本插件已经测试成功.请需要安装的童鞋放心.
插件参照如下网址:http://www.discuz.net/thread-1852325-1-1.html

安装步骤:
参照原文:http://www.yookoala.idv.hk/en/node/24仅支持Discuz!6.0,修改后,使其在DZX1.0下使用。具体做法:
首先在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 2 3 4 5 | // recaptcha hack start require_once DISCUZ_ROOT.'./source/include/recaptcha/recaptchalib.php'; $recaptcha_publickey = '这里替换为你申请到的Public Key'; $recaptcha_show = recaptcha_get_html($recaptcha_publickey); // recaptcha hack end |
查找:
1 | $username = addslashes(trim(dstripslashes($username))); |
在上面添加:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | // recaptcha hack start require_once DISCUZ_ROOT.'./source/include/recaptcha/recaptchalib.php'; $recaptcha_privatekey = '这里替换为你申请到Private Key'; $resp = recaptcha_check_answer ($recaptcha_privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { // What happens when the CAPTCHA was entered incorrectly if ($resp->error = 'incorrect-captcha-sol') { $resp->error = "验证码输入不正确,请按\"刷新\"按钮重新获取验证码并再试一次。"; } showmessage('reCAPTCHA failed. reCAPTCHA said: ' . trim($resp->error)); } // recaptcha hack end |
打开template/default/member/register.htm
1 2 | <p id="layer_reginfo_b" class="fsb cl">
<!--{if $_G['setting']['sitemessage'][register]}--> |
在上面添加:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <!--{if $recaptcha_show}-->
<label>
<script type="text/javascript">
var RecaptchaOptions = {
theme: 'custom',
lang: 'en',
callback: 'Recaptcha.focus_response_field',
custom_theme_widget: 'recaptcha_widget',
custom_translations: {
play_again: "重播",
cant_hear_this: "下载MP3"} };
</script>
<div id="recaptcha_widget" style="display:none">
<div id="recaptcha_image"></div>
<div class="recaptcha_only_if_incorrect_sol" style="color:red">输入验证码错误,请重试一次。</div>
<span class="recaptcha_only_if_image">验证码:</span>
<span class="recaptcha_only_if_audio">输入您听到数字:</span>
<input type="text" id="recaptcha_response_field" name="recaptcha_response_field" /> *
<span><a href="javascript:Recaptcha.reload()">刷新</a></span>
<span class="recaptcha_only_if_image"> | <a href="javascript:Recaptcha.switch_type('audio')">声音</a></span>
<span class="recaptcha_only_if_audio"> | <a href="javascript:Recaptcha.switch_type('image')">文字</a></span>
<span> | <a href="javascript:Recaptcha.showhelp()">帮助</a></span>
<p>$recaptcha_show</p>
</label>
<p style="color: blue;">提示: 为提高输入验证码成功率,当您感到验证码辨识困难时,</p>
<p style="color: blue;">请按上面的刷新按钮重新获取新的验证码,直到您满意为止。</p>
<!--{/if}--> |
进入管理后台,全局——防灌水设置——验证码设置,取消新用户注册验证;
界面——界面设置——启用浮动窗口——取消注册窗口浮动
更新缓存,OK。
如果你从未修改过注册文件,直接用下载的文件覆盖即可(请务必事先做好备份)。
不想自己改,用下面是修改好的文件,免费下载:
reCAPTCHAforDZX1.0&1.5 (64)
该插件可在1.5中正常使用.需要key的请使用下面的
This is a global key. It will work across all domains.
Public Key: 6LcUsr4SAAAAAMx-gLnOj5WaK5LXFKEtz1pC_Sbr
Use this in the JavaScript code that is served to your users
Private Key: 6LcUsr4SAAAAABZpdoXOL98_lmqQfPa7z-CALTEu
Use this when communicating between your server and our server. Be sure to keep it a secret.
到此一游