1.在模板文件中加入如下JS代码:
<script type="text/javascript">
$ = jQuery;
function changeAuthCode() {
var num = new Date().getTime();
var rand = Math.round(Math.random() * 10000);
num = num + rand;
$('#ver_code').css('visibility','visible');
if ($("#vdimgck")[0]) {
$("#vdimgck")[0].src = "../include/vdimgck.php?tag=" + num;
}
return false;
}
</script>
2.找到对应的php文件,即/plus/diy.php
在头部引入文件:
require_once(DEDEINC.'/membermodel.cls.php');
找到 elseif($do == 2)
{
********************************
在下面插入代码:
//验证码验证
// $vdcode=$_POST['vdcode'];
if(!isset($vdcode))
{
$vdcode = '';
}
$svali = GetCkVdValue();
if(preg_match("/6/",$safe_gdopen)){
if(strtolower($vdcode)!=$svali || $svali=='')
{
ResetVdValue();
ShowMsg('验证码错误!', '-1');
exit();
}
}
**************************************
3.在要添加验证码的位置加入以下代码:
<input type="text" class="entry ent-2 w-156 " style=" width:80px; text-transform: uppercase;" id="vdcode" name="vdcode" class="code"/>
<img id="vdimgck" align="absmiddle" οnclick="this.src=this.src+'?'" style="cursor: pointer;" alt="看不清?点击更换" src="/include/vdimgck.php"/> 看不清? <a href="javascript:void(0)" οnclick="changeAuthCode();">点击更换</a>