1.下载验证码文件captcha,下载地址:https://pan.baidu.com/s/1h6hSkuZcSKUdbINYfx-D5Q 密码: 7uha
2.将下载下面的验证码文件解压,将得出的整个文件夹传自己的网站模板目录下。
3.打开用户注册模板文件reg-page.php,使用Dreamweaver软件打开这个文件;
4.找到if($error == ”) {这段代码,在它上面粘贴以下的代码:
//验证码错误
if (!isset($_SESSION))
session_start();
session_regenerate_id(TRUE);
if(empty($_POST['captcha_code'])|| empty($_SESSION['ludou_lcr_secretword'])|| (trim(strtolower($_POST['captcha_code'])) != $_SESSION['ludou_lcr_secretword']) )
$error .= '<strong>错误</strong>:验证码不正确!<br />';
5.在注册框的提交按钮的上方,添加以下的代码,用于显示验证码:
<p class="zc00">
<label for="user_email">验 证 码: <input id="CAPTCHA" class="input" type="text" tabindex="24" size="10" value="" name="captcha_code" /><img id="captcha_img" src="<?php bloginfo('template_url'); ?>/captcha/captcha.php" /><a href="javascript:void(0)" onclick="document.getElementById('captcha_img').src='<?php bloginfo('template_url'); ?>/captcha/captcha.php?'+Math.random();document.getElementById('CAPTCHA').focus();return false;" class="kbq">看不清</a>
</label>
</p>
6.这样,用户注册页面就会出现验证码了,用户注册时,必须正确填写验证码才可以成功注册,防止恶意批量注册。
感谢您的来访,获取更多精彩文章请收藏本站。

© 版权声明
THE END
暂无评论内容