<% Const EW_PAGE_ID = "login" %> [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] <% Response.Expires = 0 Response.ExpiresAbsolute = Now() - 1 Response.AddHeader "pragma", "no-cache" Response.AddHeader "cache-control", "private, no-cache, no-store, must-revalidate" %> <% ' Open connection to the database Dim conn Set conn = Server.CreateObject("ADODB.Connection") conn.Open EW_DB_CONNECTION_STRING %> <% Dim Security Set Security = New cAdvancedSecurity %> <% ' Common page loading event (in userfn60.asp) Call Page_Loading() %> <% ' Page load event, used in current page Call Page_Load() %> <% Dim bValidate, bValidPwd, sUsername, sPassword Dim sLoginType Dim sLastUrl sLastUrl = Security.LastUrl ' Get Last Url If sLastUrl = "" Then sLastUrl = "default.asp" If Not Security.IsLoggedIn() Then Call Security.AutoLogin() bValidate = False If Request.Form("submit") <> "" Then ' Setup variables sUsername = Request.Form("Username") sPassword = Request.Form("Password") sLoginType = LCase(Request.Form("rememberme")) bValidate = True Else If Security.IsLoggedIn() Then If Session(EW_SESSION_MESSAGE) = "" Then Page_Terminate(sLastUrl) ' Return to last accessed page End If End If If bValidate Then bValidPwd = False ' Call loggin in event bValidate = User_LoggingIn(sUsername, sPassword) If bValidate Then bValidPwd = Security.ValidateUser(sUsername, sPassword) If Not bValidPwd Then Session(EW_SESSION_MESSAGE) = "Incorrect user ID or password" ' Invalid user id/password Else If Session(EW_SESSION_MESSAGE) = "" Then Session(EW_SESSION_MESSAGE) = "Login cancelled" ' Login cancelled End If If bValidPwd Then ' Write cookies If sLoginType = "a" Then ' Auto login Response.Cookies(EW_PROJECT_NAME)("autologin") = "autologin" ' Set up autologin cookies Response.Cookies(EW_PROJECT_NAME)("username") = sUsername ' Set up user name cookies Response.Cookies(EW_PROJECT_NAME)("password") = ew_Encode(TEAencrypt(sPassword, EW_RANDOM_KEY)) ' Set up password cookies Response.Cookies(EW_PROJECT_NAME).Expires = DateAdd("d", 365, Date) ' Change the expiry date of the cookies here ElseIf sLoginType = "u" Then ' Remember user name Response.Cookies(EW_PROJECT_NAME)("autologin") = "rememberUsername" ' Set up remember user name cookies Response.Cookies(EW_PROJECT_NAME)("username") = sUsername ' Set up user name cookies Response.Cookies(EW_PROJECT_NAME).Expires = DateAdd("d", 365, Date) ' Change the expiry date of the cookies here Else Response.Cookies(EW_PROJECT_NAME)("autologin") = "" ' Clear autologin cookies End If ' Call loggedin event Call User_LoggedIn(sUsername) Call ew_WriteAuditTrailOnLogInOut("login") Call Page_Terminate(sLastUrl) ' Return to last accessed url End If End If %> [an error occurred while processing this directive]

Login Page

<% If Session(EW_SESSION_MESSAGE) <> "" Then %>

<%= Session(EW_SESSION_MESSAGE) %>

<% Session(EW_SESSION_MESSAGE) = "" ' Clear message End If %>
User Name ">
Password
  <% If Request.Cookies(EW_PROJECT_NAME)("autologin") = "autologin" Then %> Auto login until I logout explicitly
Save my user name
Always ask for my user name and password <% ElseIf Request.Cookies(EW_PROJECT_NAME)("autologin") = "rememberUsername" Then %> Auto login until I logout explicitly
Save my user name
Always ask for my user name and password <% Else %> Auto login until I logout explicitly
Save my user name
Always ask for my user name and password <% End If %>

[an error occurred while processing this directive] <% ' If control is passed here, simply terminate the page without redirect Call Page_Terminate("") ' ----------------------------------------------------------------- ' Subroutine Page_Terminate ' - called when exit page ' - clean up ADO connection and objects ' - if url specified, redirect to url, otherwise end response ' Sub Page_Terminate(url) ' Page unload event, used in current page Call Page_Unload() ' Global page unloaded event (in userfn60.asp) Call Page_Unloaded() conn.Close ' Close Connection Set conn = Nothing Set Security = Nothing ' Go to url if specified If url <> "" Then Response.Clear Response.Redirect url End If ' Terminate response Response.End End Sub ' ' Subroutine Page_Terminate (End) ' ---------------------------------------- %> <% ' Page Load event Sub Page_Load() '***Response.Write "Page Load" End Sub ' Page Unload event Sub Page_Unload() '***Response.Write "Page Unload" End Sub %> <% ' User Logging In event Function User_LoggingIn(usr, pwd) On Error Resume Next ' Enter your code here ' To cancel, set return value to False User_LoggingIn = True End Function ' User Logged In event Sub User_LoggedIn(usr) ' Response.Write "User Logged In" End Sub %>
Site hosted by Angelfire.com: Build your free website today!