标题:求助:asp后台管理,怎么取消验证码?
取消只看楼主
sxfbest
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2018-3-14
结帖率:0
已结贴  问题点数:20 回复次数:0 
求助:asp后台管理,怎么取消验证码?
情况是这样的:密码输入正确,验证码输入正确,还是提示验证码错误,服务器是win2008的。
<!--#include file="inc/AspCms_SettingClass.asp" -->
<%
dim action : action=getForm("action","get")
if action = "login" then
    dim UserName,Password,sql,code,Rs,atype
    UserName = filterPara(getForm("username","post"))
    atype = getForm("atype","post")
    Password = md5(getForm("Password","post"),16)
   
   
    if isOutSubmit then  alertMsgAndGo"非法外部提交被禁止","-1"

'    User UserGroup
'    LoginName
'Password
'GroupID
'IsAdmin
    sql = "select count(*) from {prefix}User where LoginName = '"& UserName &"' and Password='"&Password&"'"
    Dim rsObj : Set rsObj=Conn.Exec(sql,"r1")
    if rsObj(0)=1 then
   
        
        Set rsObj=Conn.Exec("select IsAdmin, GroupStatus,GroupName, UserStatus, UserID, GroupMenu,GroupSort, LanguageID,adminrand from {prefix}User as a, {prefix}UserGroup as b where LoginName='"&UserName&"' and a.GroupID=b.GroupID","r1")   
        if not rsObj.Eof Then
            if rsObj("IsAdmin")<>1 then alertMsgAndGo"对不起,你不是管理员!","-1"
            if rsObj("GroupStatus")<>1 then alertMsgAndGo"对不起,您所在用户组已被禁用!","-1"
            if rsObj("UserStatus")<>1 then alertMsgAndGo"对不起,您的账号已被禁用!","-1"
            Session("adminName")=UserName
            Session("GroupName")=rsObj("GroupName")
            'wCookie"adminpwd",getForm("Password","post")
            Session("adminpwd") = getForm("Password","post")
            Session("adminId")=rsObj("UserID")
            Session("groupMenu")=repnull(rsObj("GroupMenu"))
            Session("GroupSort")=repnull(rsObj("GroupSort"))
            Session("sitepath")=SitePath
            '查找
            dim LanguageID
            LanguageID=rsObj("LanguageID")

            if isnul(LanguageID) then                 
                set rs=conn.exec("select LanguageID,LanguagePath,Alias from {prefix}Language where IsDefault=1","exe")
                if rs.eof then                    
                    echoErr err_15,15,"没有设置默认语言"
                else
                    LanguageID=rs(0)
                end if
            else     
                set rs=conn.exec("select LanguageID,LanguagePath,Alias from {prefix}Language where LanguageID="&LanguageID,"exe")               
                LanguageID=rs(0)   
            end if
            randomize
            dim randnum
            randnum=clng(rnd*99999999)
            Conn.Exec"update {prefix}User set adminrand='"& randnum &"' where UserID="&rsObj("UserID"),"exe"   
            Session("adminrand")=rsObj("adminrand")   
            Session("languageID")=LanguageID            
            Session("LanguagePath")=rs("LanguagePath")
            Session("LanguageAlias")=rs("Alias")
            

            rs.close : set rs=nothing
            Conn.Exec"update {prefix}User set LastLoginTime='"&now()&"',LastLoginIP='"&getIp()&"',LoginCount=LoginCount+1 where UserID="&rsObj("UserID"),"exe"   
            if atype=0 then        
            response.Redirect("index.asp")
            else
            response.Redirect("index_user.asp")   
            end if
        end if
    else
        alertMsgAndGo "用户名或密码错误!","-1"
    end if
    rsObj.Close() : set rsObj=Nothing   
elseif action = "logout" then
    Session("adminName")=""
    Session("adminId")=""
    Session("groupMenu")=""
    Session("SceneMenu")=""
    response.Redirect("login.asp"):response.End()
elseif action = "relog" then
    alertMsgAndGo "对不起,您的登录状态已经失效,请重新登录!","login.asp"
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=setting.siteTitle%></title>
<link href="images/style2.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript">
<!--
    window.onload = function (){
        var txtUserName = document.getElementById("username");
        var txtPassword = document.getElementById("password");
        changeimg();
        var username = readCookie("username");
        if(username!="")
        {
        txtUserName.value = username;
        txtPassword.focus();
        }
        else    txtUserName.focus();
        document.getElementById("code").value = "";
    }
function changeimg(){document.getElementById('SeedImg').src='../inc/checkcode.asp?'+Math.random();}
function writeCookie(name, value, hours){
  var expire = "";
  if(hours != null)  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;

}
function readCookie(name){
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0) {
    offset = document.cookie.indexOf(search);
    if (offset != -1)  {
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}


-->
搜索更多相关主题的帖子: if then UserName Session end 
2018-03-14 16:56



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-485268-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.110474 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved