<%@ LANGUAGE=VBScript EnableSessionState=false LCID=1033 %> <% ' -------------------------------- PRELUDE ------------------------------------- Dim Email, Password, AutoLogin Dim FromSection, NextPage, SessionExpired, ExpiredAt ' ------------------------------- PRE-PAGE ------------------------------------- Sub PrePage General_PrePage() ' -------------------------- ' Read Input Variables ' -------------------------- FromSection = ParseRequestText(Request("From"), null, null) NextPage = ParseRequestText(Request("NextPage"), null, null) SessionExpired = ParseRequestBoolean(Request("SessionExpired"), False, null) ExpiredAt = ParseRequestText(Request("ExpiredAt"), null, null) ' -------------------------- ' Setup Page Variables ' -------------------------- Page.Title = "Login" Page.HideToolbar = HIDE_TOOLBAR ' -------------------------- ' Check If Already Logged In ' -------------------------- If (Session.UserID > 0) Then RedirectTo("/apps/clients/home.asp") End If End Sub ' ------------------------------- POST-PAGE ------------------------------------ Sub PostPage General_PostPage() End Sub ' ------------------------------ VALIDATION ------------------------------------ Sub Validation Dim Rs, SQL Dim ClientID, DBPassword, IsActive Dim RecordLogin ' -------------------------- ' Read Form Inputs ' -------------------------- Email = ParseFormText("Email", "", null) Password = ParseFormText("Password", "", null) AutoLogin = ParseFormBoolean("AutoLogin", False, null) ' -------------------------- ' Validate Form Fields ' -------------------------- FormCheckRequired "Email", "You must enter your e-mail address." FormCheckRequired "Password", "You must enter your password." If (Not ErrorsExist()) Then ' -------------------------- ' Check Username & Password ' -------------------------- SQL = "SELECT client_id, password, is_active" &_ " FROM t_Main_Clients" &_ " WHERE email = " & FormatSQLText(Email) Set Rs = Database.GetSingleRecord(SQL) If (Not Rs.EOF) Then DBPassword = ParseSQLText(Rs("password")) IsActive = ParseSQLBoolean(Rs("is_active")) If (Password <> DBPassword) Then AddError "Password", "The password you entered is incorrect." ElseIf (Not IsActive) Then AddError "IsActive", "Your account has been de-activated. Please contact support for more information." Else ClientID = ParseSQLInteger(Rs("client_id")) End If Else AddError "Email", "The e-mail address you entered is not registered." End If Rs.Close ' -------------------------- ' Log User In & Redirect ' -------------------------- If (Not ErrorsExist()) Then ' -------------------------- ' Record Login ' -------------------------- RecordLogin = True DoLogin ClientID, Email, RecordLogin ' -------------------------- ' Check for autologin ' -------------------------- If (AutoLogin) Then SetAutoLogin() End If ' ***TODO*** ' Add hook in here for when ads purchased == ads used to redirect ' to resubscribe page. Possible add the hook in the DoLogin ' function. ' -------------------------- ' Redirect ' -------------------------- If (Not IsBlank(NextPage)) Then RedirectTo(NextPage) Else RedirectTo("/apps/clients/home.asp") End If End If End If End Sub ' -------------------------------- OUTPUT -------------------------------------- Sub Output If (SessionExpired) Then %>

<%= bt_NormalText %> Your session has expired. You will need to log in again.

NOTE: Sessions expire after 20 minutes of inactivity as a security feature. This prevents someone from sitting down at a computer that you were logged into and accessing your account. <%= et_NormalText %>

<% End If %>
<% DisplayErrors() %> <% AddHiddenFormVar "NextPage", NextPage %> <%= FormStart() %>
<%= bt_FormFieldLabel %> <% HighlightOnError "Email", "E-mail:" %> <%= et_FormFieldLabel %>
<%= bt_FormFieldLabel %> <% HighlightOnError "Password", "Password:" %> <%= et_FormFieldLabel %>
<%= FormCheckbox("AutoLogin", AutoLogin, True) %> <%= bt_NormalText %> Remember my e-mail and
password on this computer<%= et_NormalText %>

<%= bt_NormalText %>
">Don't Have An Account? Register Now! <%= et_NormalText %>
<% End Sub %>