<!--#include file="../Inc/Cls_Main.Asp"-->
<%
If Not Easp.CheckDataFrom() Then
    Easp.AlertUrl "Error 404!", "/"
End If
Dim AdminName, PassWord, AdminCode, i, Result, FieldList, RoleName
AdminName = Trim(Easp.Post("txtAdminName:s"))
PassWord = Trim(Easp.MD5(Easp.Post("txtPassWord")))
AdminCode = Trim(Easp.Post("txtAdminCode:n:0"))
'=====================================================
If Easp.IsN(AdminName) Then
    Easp.AlertUrl "请输入您的用户名!", "Admin_Login.Asp"
End If
If Easp.IsN(PassWord) Then
    Easp.AlertUrl "请输入您的密码!", "Admin_Login.Asp"
End If
If AdminCode = 0 Then
    Easp.AlertUrl "请输入您的验证码!", "Admin_Login.Asp"
End If
If AdminCode <> Session("ZjjCmsAdminCode") Then
    Easp.AlertUrl "您输入的认码和系统产生的不一致，请重新输入!", "Admin_Login.Asp"
    Session("ZjjCmsAdminCode") = ""
End If
Session("ZjjCmsAdminCode") = ""
'=====================================================
FieldList = "Id,RoleId,RoleType,AdminName,AdminPass,LoginTime,LoginIp,LoginNum,IsLock"
Result = Easp.db.RT(TablePrefix & "Admin", " AdminName = '"& AdminName &"' ", FieldList)
If Easp.IsN(Result) Then
    Easp.AlertUrl "用户或密码错误!", "Admin_Login.Asp"
Else
    If Result(4) <> PassWord Then
        Easp.AlertUrl "用户或密码错误!", "Admin_Login.Asp"
    Else
        If Result(8) = 1 Then
            Easp.AlertUrl "你的用户名已被锁定,你不能登陆！如要开通此帐号，请联系管理员!", "Admin_Login.Asp"
        Else
            i = Easp.db.UR(TablePrefix & "Admin", " Id = "& Result(0) &" ", Array("LoginTime:" & Now(), "LoginIp:" & Easp.GetIp(), "LoginNum:" & Result(7) + 1))
            RoleName = Easp.db.RT(TablePrefix & "Admin_Role", " Id = "& Result(1) &" ", "RoleName")
            '=====================================
            Easp.SetCookie "ZjjCmsCms>AdminId", Result(0), 180
            Easp.SetCookie "ZjjCmsCms>RoleId", Result(1), 180
            Easp.SetCookie "ZjjCmsCms>RoleType", Result(2), 180
            Easp.SetCookie "ZjjCmsCms>RoleName", RoleName, 180
            Easp.SetCookie "ZjjCmsCms>AdminName", Result(3), 180
            Easp.SetCookie "ZjjCmsCms>AdminPass", PassWord, 180
            Easp.SetCookie "ZjjCmsCms>LoginTime", Result(5), 180
            Easp.SetCookie "ZjjCmsCms>LoginIp", Result(6), 180
            Easp.SetCookie "ZjjCmsCms>LoginNum", Result(7), 180
            Easp.SetCookie "ZjjCmsCms>IsLock", Result(8), 180
            Easp.RR("Admin_Index.Asp")
        End If
    End If
End If
%>