%
Call Main
Sub Main
Select Case Request.QueryString("A")
Case "o"
Logoutmynetwork
Case Else
VerifyLogin
End Select
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Sub VerifyLogin
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub VerifyLogin
Dim cnDB ' As ADODB.Connection
Set cnDB = OpenDB()
Dim rsData ' As ADODB.Recordset
Dim strSQL ' As String
Dim strUsername ' As String
Dim strPassword ' As String
Dim strTargetPage ' As String
Dim lngTempPassword ' As Long Integer
strUsername = LCase(Trim(Request("Username")))
strPassword = Trim(Request("Password"))
'''''''''''''''''''''''''''''''''''''''''
' process username and password
'
'''''''''''''''''''''''''''''''''''''''''
strSQL = "SELECT * FROM tblAccounts WHERE Username like " & DQ & strUsername & DQ
DBC "SQL = " & strSQL
Set rsData = cnDB.Execute (strSQL)
'''''''''''''''''''''''''''''''''''''''
' Check to see if the account exists
'
' '''''''''''''''''''''''''''''''''''''
If rsData.BOF AND rsData.EOF then
''''''''''''''''''''''''
' clean up recordset
''''''''''''''''''''''''
rsData.Close
Set rsData = Nothing
CloseDB cnDB
Session("ErrorText") = "That Username does not match any accounts in our system."
Response.Redirect "login.asp"
End If
'''''''''''''''''''''''''''''''''''''''
' Check to see if Password matches
'
'''''''''''''''''''''''''''''''''''''''
If strPassword = rsData("Password") Then
'''''''''''''''''''''''
' create temporary
' password
'''''''''''''''''''''''
Randomize()
lngTempPassword = Int(100000000 + (900000000 * Rnd()))
DBC "lngTempPassword = " & lngTempPassword
DBC "pkAccountID = " & rsData("pkAccountID")
'''''''''''''''''''''''''''''
' Create cookie
'
'''''''''''''''''''''''''''''
Response.Cookies("mynetwork")("Username") = strUsername
Response.Cookies("mynetwork")("TempPassword") = lngTempPassword
Response.Cookies("mynetwork")("AID") = rsData("pkAccountID")
Response.Cookies("mynetwork").Expires = DateAdd("d", 1, date)
DBC "Cookies = "
DBC Request.Cookies("mynetwork")("Username")
DBC Request.Cookies("mynetwork")("TempPassword")
DBC "AID = " & Request.Cookies("mynetwork")("AID")
'''''''''''''''''''''''''''''
' Grant Access
'
'''''''''''''''''''''''''''''
Session("Access") = "Granted"
DBC "Access = " & Session("Access")
'''''''''''''''''''''''''''''''''''''
' Determine if this is the first
' time the user has signed in.
'
'''''''''''''''''''''''''''''''''''''
DBC "pkCompanyID = " & rsData("pkCompanyID")
If rsData("pkCompanyID") = 0 Then
strTargetPage = "orgs_form.asp?a=c&rtp=default"
Session("ErrorText") = "Please create your company or organization (not the client you at)."
Else
If Session("TargetPage") <> "" Then
strTargetPage = Session("TargetPage")
Else
strTargetPage = "default.asp"
End If
End If
''''''''''''''''''''''''
' clean up recordset
''''''''''''''''''''''''
rsData.Close
Set rsData = Nothing
'''''''''''''''''''''''''''''
' Enter Site
'
'''''''''''''''''''''''''''''
If TESTING = "ON" Then
WL "
Go to " & strTargetPage & ""
Else
Response.Redirect strTargetPage
End If
Else
Session("ErrorText") = "The password does not match the Username you entered."
Response.Redirect "login.asp"
End If
CloseDB cnDB
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Sub Logoutmynetwork
'
' This routine removes the cookie and returns you to default.asp
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Logoutmynetwork
'''''''''''''''''''''''''''''''
' Clear Cookie
'''''''''''''''''''''''''''''''
Response.Cookies("mynetwork") = ""
Session("Access") = "Denied"
Session("TargetPage") = ""
Session("ErrorText") = "Thank you for logging out."
If TESTING = "ON" Then
WL "
login.asp"
Else
Response.Redirect "default.asp"
End If
End Sub
%>