<!--#include file="Include/Const.Asp"-->
<!--#include file="Include/NoSQL.Asp" -->
<!--#include file="Include/ConnSiteData.Asp"-->
<!--#include file="Include/Md5.Asp"-->
<%
If request.QueryString("Action") = "Out" Then
    session.contents.Remove "MemName"
    session.contents.Remove "GroupID"
    session.contents.Remove "GroupLevel"
    session.contents.Remove "MemLogin"
    response.redirect CStr(request.ServerVariables("HTTP_REFERER"))
    response.End
End If

Dim LoginName, LoginPassword, VerifyCode, MemName, Password, GroupID, GroupName, Working, rs, sql
LoginName = Trim(request.Form("LoginName"))
LoginPassword = Md5(request.Form("LoginPassword"))
Set rs = server.CreateObject("adodb.recordset")
sql = "select * from Shenbi_Members where MemName='"&LoginName&"'"
rs.Open sql, conn, 1, 3
If rs.bof And rs.EOF Then
    response.Write "<script language='JavaScript'>alert('用户名错误或不存在！');" & "history.back()" & "</script>"
    response.End
Else
    MemName = rs("MemName")
    Password = rs("Password")
    GroupID = rs("GroupID")
    GroupName = rs("GroupName")
    Working = rs("Working")
End If

If LoginPassword<>Password Then
    response.Write "<script language='JavaScript'>alert('用户密码错误！');" & "history.back()" & "</script>"
    response.End
End If

If Not Working Then
    response.Write "<script language='JavaScript'>alert('帐号被禁用！');" & "history.back()" & "</script>"
    response.End
End If

If UCase(LoginName) = UCase(MemName) And LoginPassword = Password Then
    rs("LastLoginTime") = Now()
    rs("LastLoginIP") = Request.ServerVariables("Remote_Addr")
    rs("LoginTimes") = rs("LoginTimes") + 1
    rs.update
    rs.Close
    Set rs = Nothing
    session("MemName") = MemName
    session("GroupID") = GroupID
    Set rs = server.CreateObject("adodb.recordset")
    sql = "select * from Shenbi_MemGroup where GroupID='"&GroupID&"'"
    rs.Open sql, conn, 1, 1
    session("GroupLevel") = rs("GroupLevel")
    rs.Close
    Set rs = Nothing
    session("MemLogin") = "Succeed"
    session.timeout = 60
    response.redirect "Index.Asp"
    response.End
End If
%>