This code basically shows how to implement a simple XML database to validate user logins
If you choose to implement a simple XML database for you users usernames and passwords.

Consider an xml file of the following format

<users>
    <john role="admin">pass1</john>
    <jen role="user">pass2</jen>
    <joey role="user">pass3</joey>
</users>


Note: These passwords normally have to be encrypted, we left it so for simplicity.

Your is function will look something like this

Function IsValidUser(usr, pwd)
    'reset all variables
    IsValidUser = False
    Session("UserRole") = ""

    'On Error Resume Next
    Dim xmldoc, nodeList, node
    Set xmldoc = Server.CreateObject("Microsoft.XMLDOM")
    xmldoc.async = False

    'xmldoc.load(Server.MapPath("users.xml"))
    xmldoc.load("D:\secure\users.xml")

    If xmldoc.parseError.ErrorCode=0 Then
        Set nodeList = xmldoc.documentElement.getElementsByTagName(usr)
        If nodeList.length>0 Then
            If nodeList.Item(0).Text = pwd Then
                IsValidUser = True
                On Error Resume Next
                Session("UserRole") = nodeList.Item(0).attributes.getNamedItem("role").nodeValue
                If Err.Number<>0 Then
                    Session("UserRole") = "GUEST"
                End If
            End If
        End If
    End If

    Set
xmldoc = Nothing
End Function