PHPCMS验证码出错(没解决,直接删掉了)

来源:互联网 发布:电动剃须刀,知乎 编辑:程序博客网 时间:2024/06/02 01:49

phpcms v9 关闭前台和后台登陆验证码方法

参考下面2个blog

from:http://blog.csdn.net/laofeng9/article/details/8076601 &  http://www.cms178.com/?post=593

前台关闭验证码 

删除下面的代码 

\phpcms\modules\member\index.php  查找“//判断验证码”下面4行代码: 

1//判断验证码
2    $code = isset($_POST['code']) && trim($_POST['code']) ? trim($_POST['code']) : showmessage(L('input_code'), HTTP_REFERER);
3    if ($_SESSION['code'] != strtolower($code)) {
4     showmessage(L('code_error'), HTTP_REFERER);
5    }

\phpcms\templates\default\member\login.html 模板页面代码:

1<div class="input">
2   <label>{L('checkcode')}:</label><input type="text" id="code"name="code" size="8" class="input-text">{form::checkcode('code_img', '4', '14', 84, 24)}
3</div>

 

后台验证码关闭方法类似,路径和文件名不一样

 

view source
print?
1\phpcms\modules\admin\index.php
  1. //不为口令卡验证

    if (!isset($_GET['card'])) {

    $username = isset($_POST['username']) ? trim($_POST['username']) : showmessage(L('nameerror'),HTTP_REFERER);

    $code = isset($_POST['code']) && trim($_POST['code']) ? trim($_POST['code']) :showmessage(L('input_code'), HTTP_REFERER);

    if ($_SESSION['code'] != strtolower($code)) {

    showmessage(L('code_error'), HTTP_REFERER);

    }

改为:

  1. //不为口令卡验证

    if (!isset($_GET['card'])) {

    $username = isset($_POST['username']) ? trim($_POST['username']) ;

     showmessage(L('nameerror'),HTTP_REFERER);


    if ($_SESSION['code'] != strtolower($code)) {


    }


 

登陆模板,这点后缀名是php,实际是html模板文件

 

1\phpcms\modules\admin\templates\login.tpl.php


删除以下代码:

  1. <label><?php echo L('security_code')?>:</label><input name="code" type="text" class="ipt ipt_reg" onfocus="document.getElementById('yzm').style.display='block'" />
        <div id="yzm" class="yzm"><?php echo form::checkcode('code_img')?><br /><a href="javascript:document.getElementById('code_img').src='<?php echo SITE_PROTOCOL.SITE_URL.WEB_PATH;?>api.php?op=checkcode&m=admin&c=index&a=checkcode&time='+Math.random();void(0);"><?php echo L('click_change_validate')?></a></div>


0 0