%@ LANGUAGE="VBSCRIPT" %>
<%
Dim strEmail, intLoginRequest, _
strPassword, strMainPrompt, intPassChk
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
strEmail = Request.Form("Email")
strPassword = Request.Form("Password")
CheckPassword
Else
strMainPrompt = "Please enter your email address and password."
End If
%>
Integrated Systems Technology - Distribution Software, Internet Solutions301 Moved
<%
Sub CheckPassword()
on error resume next
'Declare Variables
Dim objLogin, intPassResult, intCheckResult, rstLogin
'Instantiate COM Object
Set objLogin = Server.CreateObject("ISTweb.ISTusers")
If Err.Number <> 0 Then
strMainPrompt = err.number & err.description & " An error occurred while trying to create an instance of the Users component. Please try to log in again later."
Exit Sub
End If
'Check password and retrieve numerical confirmation. 0 for failure, non-0 for success
intPassResult = CLng(objLogin.CheckPassword(Application("DSN"), strEmail, strPassword))
If Err.Number <> 0 Then
'strMainPrompt = "An error occurred (" & Hex(Err.Number) & ") while checking the database. Please try to log in again later."
strMainPrompt = Hex(Err.Number) & Err.Description
Exit Sub
End If
'If password is correct, then take appropriate action
If intPassResult = 1 Then
'Set session variable for authentication
Session("UserID") = strEmail
'Set session variables for user
rstLogin = objLogin.GetUserInfo(Application("DSN"), strEmail)
Session("CompanyName") = Trim(rstLogin("companyname"))
Session("UserApplication") = Trim(rstLogin("userapplication"))
Session("AccountNo") = Trim(rstLogin("accountno"))
'Redirect to proper page based on User Application
If Session("UserApplication") = "Navision" Then
Session("SearchDatabase") = "NAVdocs"
Session("DocPath") = "navdocs"
Response.Redirect("navusers.asp")
Else
Session("SearchDatabase") = "IMSdocs"
Session("DocPath") = "imsdocs"
Response.Redirect("imsusers.asp")
End If
'Prepare error message for display because password is incorrect
Else
strMainPrompt = "You did not provide the correct password for this user. Please check your password and try again."
End If
End Sub
%>