<%
    '获取表单变量
    UserName = Trim(Request("UserName"))
    PassWords = Trim(Request("PassWords"))
    If UserName <> "" And PassWords <> "" Then
                Sql = "select user_id,user_name from icms_user_v where user_name='" & LCase(UserName) & "'"
        Rs.Open Sql,Conn,1,3
        If Rs.Eof Or Rs.Bof Then
            Rs.Close            
            Call SysMsgDisplay(1,"用户:" & UserName & "不存在,请检查您输入的用户名是否正确!","用户登录","")
        ElseIf Rs(2) <> MD5(PassWords) Then
            Rs.Close
            Call CloseDatabase()
            Call SysMsgDisplay(1,"密码验证错误,请检查您输入的密码是否正确。<br>如果您忘记了密码,请联系管理员重新初始化密码</a>!","用户登录","")
        Else
            '确认登录,获取用户基本信息并缓存Session
            Session("UserID") = cCur(Rs(0))
            Session("UserName") = Rs(1)                        
            Rs.Close                                    
            Response.Redirect("index.asp")
        End If
    End If
%>
大概就是这样的