<!--#include file="../Inc/Consts.inc"-->
<!--#include file="../Inc/Common.Asp"-->
<!--#include file="../Inc/strfunc.Asp"-->
<!--#include file="../Inc/Md5.Asp"-->
<%
setCookies = "CompanyZY"
' Ss简单网站管理系统-开源版 
'晴天设计www.xxzwz.com
Dim CheckCode,AdminLoginCode,LoginName, LoginPassword, AdminName, Password, AdminPurview, Working, UserName, rs, sql
LoginName = ReplaceBadChar(Trim(request.Form("UserName")))
LoginPassword = Md5(ReplaceBadChar(request.Form("password")))
CheckCode = LCase(ReplaceBadChar(Trim(Request.Form("CheckCode"))))
AdminLoginCode = Trim(Request("AdminLoginCode"))
'Call SiteInfo()
If CheckCode = "" Then Call Alert("验证码不能为空，请返回检查！","b-1"):response.End
If Trim(Session("CheckCode")) = "" Then Call Alert("您在管理登录停留的时间过长，导致验证码失效。\n请重新返回登录页面进行登录。","Ss_login.asp"):response.End
If CheckCode <> Session("CheckCode") Then Call Alert("您输入的验证码和系统产生的不一致，请重新输入。","b-1"): response.End
If EnableSiteManageCode = True And AdminLoginCode <> SiteManageCode Then Call Alert("您输入的后台管理认证码不对，请重新输入。" ,"b0"):response.End
sql = "select * from "&Datapre&"_Admin where AdminName='"&LoginName&"'"
set rs=db(sql,3)
If rs.EOF Then 
	Call Alert("无此帐号，请返回检查！","b0")
    response.End
Else
    AdminName = rs("AdminName")
    Password = rs("Password")
    AdminPurview = rs("AdminPurview")
    Working = rs("Working")
    UserName = rs("UserName")
End If
If LoginPassword<>Password Then Call Alert("密码错误，请返回检查！","b0"):response.End
If Not Working Then Call Alert("帐号已被禁用！","b0"): response.End
If LoginName = AdminName And LoginPassword = Password Then
    rs("LastLoginTime") = Now()
    rs("LastLoginIP") = Request.ServerVariables("Remote_Addr")
    rs.update
    rs.Close:Set rs = Nothing
    Response.Cookies(""&setCookies&"")("AdminName") = AdminName
    Response.Cookies(""&setCookies&"")("AdminPurview") = AdminPurview
    Response.Cookies(""&setCookies&"")("LoginSystem") = "Succeed"
    Response.Cookies(""&setCookies&"")("AdminLoginCode") = AdminLoginCode
    Response.Cookies(""&setCookies&"")("LoginIP") = Request.ServerVariables("Remote_Addr")
    Dim LoginIP, LoginTime, LoginSoft
    LoginIP = Request.ServerVariables("Remote_Addr")
    LoginSoft = Request.ServerVariables("http_user_agent")
    LoginTime = Now()
    sql = "select AdminName,UserName,LoginIP,LoginSoft,LoginTime from ["&Datapre&"_AdminLog]"
    Set rs = db(sql,3)
    rs.addnew
    rs("AdminName") = AdminName
    rs("UserName") = UserName
    rs("LoginIP") = LoginIP
    rs("LoginSoft") = LoginSoft
    rs("LoginTime") = LoginTime
    rs.update
    rs.Close:Set rs = Nothing
    response.redirect "Admin_Index.Asp"
    response.End
End If
' Ss简单网站管理系统-开源版 
'晴天设计www.xxzwz.com
%>