欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

dedecms后台验证码总提示错误的解决方法

程序员文章站 2022-07-10 23:50:30
直接用下面的代码,覆盖dede中的login.php即可复制代码 代码如下:
直接用下面的代码,覆盖dede中的login.php即可
复制代码 代码如下:

<?
require_once(dirname(__file__)."/../include/config_base.php");
require_once(dirname(__file__)."/../include/inc_userlogin.php");
if(empty($dopost)) $dopost="";
//--------------------------------
//登录检测
//--------------------------------
if($dopost=="login")
{
  if(empty($validate)) $validate=="";
  else $validate = strtolower($validate);

  if( empty($_session["s_validate"]) ) $svali = "";
  else $svali = $_session["s_validate"];

   $cuserlogin = new userlogin();
     if(!empty($userid)&&!empty($pwd))
     {
              $res = $cuserlogin->checkuser($userid,$pwd);
              //成功登录
              if($res==1){
                       $cuserlogin->keepuser();
                       if(!empty($gotopage)){
                               //header("location:$gotopage");
                               showmsg("成功登录,正在转向管理管理主页!",$gotopage);
                               exit();
                       }
                       else{
                               showmsg("成功登录,正在转向管理管理主页!","index.php");
                               //header("location:index.php");
                               exit();
                       }
              }
              else if($res==-1){
                      showmsg("你的用户名不存在!","");
              }
              else{
                      showmsg("你的密码错误!","");
              }
     }//<-密码不为空
     else{
            showmsg("用户和密码没填写完整!","");
     }

//<-验证用户
}

?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>管理系统</title>
<link href="base.css" rel="stylesheet" type="text/css">
</head>
<body style='margin: 0px' bgcolor='#ffffff' leftmargin='0' topmargin='0' scroll='no'>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#111111" style="border-collapse: collapse">
  <tr> 
    <td width="100%" height="64" background="img/indextitlebg.gif"><img src="img/indextitle.gif" width="250" height="64"> 
    </td>
  </tr>
  <tr> 
    <td width="100%" height="20"> </td>
  </tr>
  <tr> 
    <td width="100%" height="20" valign="bottom">
        <table width="540" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td align="right" style="font-size: 2pt"> </td>
        </tr>
        <tr> 
          <td><img height=14 src="img/book1.gif" width=20>  用户登录</td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td width="100%" height="1" background="img/sp_bg.gif"></td>
  </tr>
  <tr> 
    <td width="100%" height="2"></td>
  </tr>
  <tr> 
    <td width="100%" height="136" valign="top">
        <form name="form1" method="post" action="login.php">
        <input type="hidden" name="gotopage" value="<?if(!empty($gotopage)) echo $gotopage;?>">
        <input type="hidden" name="dopost" value="login">
        <table width="540" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td colspan="2" height="4"></td>
          </tr>
          <tr> 
            <td width="156" height="30" align="center"> 用户名:</td>
            <td width="384"> <input type="text" name="userid" style="width:150;height:20"> 
            </td>
          </tr>
          <tr> 
            <td height="30" align="center"> 密 码: </td>
            <td> <input type="password" name="pwd" style="width:150;height:20"> 
            </td>
          </tr>

          <tr> 
            <td height="50" colspan="2" align="center"> <input type="button" name="sm1" value="登录" style="background-color:#bae171;border:1px solid #666666" onclick="this.form.submit();"> 
                <input type="button" name="sm2" value="power by dedecms" onclick="window.open('//www.jb51.net');" style="background-color:#ffffff;border:1px solid #dddddd;color:#dddddd"> 
                </td>
          </tr>
        </table>
      </form></td>
  </tr>
  <tr> 
    <td width="100%" height="2" valign="top"></td>
  </tr>
</table>
</body>
</html>