<%@ LANGUAGE = "VBScript" %> <% '----------------------------------------------------------- ' ASPilot.com - Gateway ' ------------------------------ ' Copyright © 2004 Spliethof Inc ' ' This file lists all the customer account interface for the ' shopping cart. PilotInitialize GetCurrentCustomer MarkCurrentCustomerActive mode = EStr(Request.QueryString("mode")) If Not PilotPageBegin("gateway", Empty) Then Response.Redirect g.HomePageURL & "pilot.asp" If mode = "newacct" Then strDoIt = Request.QueryString("doit") If strDoIt = "yes" Then TemplateBeforePC BILL_FNAME = Replace(Request.Form("FName"), "'", "''") BILL_LNAME = Replace(Request.Form("LName"), "'", "''") BILL_TITLE = Replace(Request.Form("Title"), "'", "''") BILL_COMPANY = Replace(Request.Form("Company"), "'", "''") BILL_ADDR1 = Replace(Request.Form("Address1"), "'", "''") BILL_ADDR2 = Replace(Request.Form("Address2"), "'", "''") BILL_CITY = Replace(Request.Form("City"), "'", "''") BILL_STATE = Replace(Request.Form("State"), "'", "''") BILL_Zip = Replace(Request.Form("Zip"), "'", "''") BILL_COUNTRY = Replace(Request.Form("Country"), "'", "''") BILL_Phone = Replace(Request.Form("Phone"), "'", "''") EMail = Replace(Request.Form("Email"), "'", "''") PWord = Replace(Request.Form("Pword"), "'", "''") BUYERNAME = Replace(Request.Form("BUYERNAME"), "'", "''") BUYERTITLE = Replace(Request.Form("BUYERTITLE"), "'", "''") INDUSTRY = Replace(Request.Form("INDUSTRY"), "'", "''") NUMBEROFGIFTS = Replace(Request.Form("NUMBEROFGIFTS"), "'", "''") NEWSLETTER = Replace(Request.Form("NEWSLETTER"), "'", "''") cid = GetNewCustID 'Find out if there is a duplicate email address. EmailIsUnique = True If ValidEmailAddress(EMail) Then Set rsLG = cnPILOT.Execute("SELECT EMAIL FROM TBLLOGINS WHERE EMAIL='"&EMail&"'") If NOT rsLG.EOF Then EmailIsUnique = False rsLG.Close : Set rsLG = Nothing Else Response.Write "



Your email address does not appear to be valid.
Please click back and pick a new email address.




" Response.End End If If Email<>"" AND PWord<>"" AND BILL_FNAME<>"" AND BILL_LNAME<>"" AND BILL_ADDR1<>"" AND BILL_CITY<>"" AND BILL_STATE<>"" AND BILL_ZIP<>"" AND BILL_COUNTRY<>"" Then If EmailIsUnique Then 'Capture the Contact Information strSQL = "INSERT INTO tblContacts(FName, LName, Title, Company, Address1, Address2, City, State, Zip, Country, Phone, Email) VALUES('"&BILL_FNAME&"', '"&BILL_LNAME&"', '"&BILL_TITLE&"', '"&BILL_COMPANY&"', '"&BILL_ADDR1&"', '"&BILL_ADDR2&"', '"&BILL_CITY&"', '"&BILL_STATE&"', '"&BILL_Zip&"', '"&BILL_COUNTRY&"', '"&BILL_Phone&"', '"&EMail&"')" Set rsContactU = cnPILOT.Execute(strSQL) Set rsContactU = Nothing Set rsBill=cnPILOT.Execute("SELECT Max(ContactID) as CntID FROM tblContacts") BillingAddressID = rsBill("CntID") Set rsBill = Nothing 'Capture to customer type information strSQL = "INSERT INTO tblContactTypeInfo(ContactID, ContactTypeID) VALUES("&BillingAddressID&", '"&CONT_WEB_CUSTOMER&"')" Set rsContactType = cnPILOT.Execute(strSQL) Set rsContactType = Nothing 'Capture the loging information dteNOW = CDate(Now()) blnShowIT = NOT g("ALLOW_CREATE_ACCT_ACTIVATE") strSQL = "INSERT INTO tblLogins(CUSTID, CONTACTID, EMAIL, PWORD, InGroupID, OrderIDIncrement, Reseller, PricingChart, LastActive, DATECREATED, SHOWIT) VALUES("&cid&", "&BillingAddressID&", '"&EMail&"', '"&PWORD&"', 4, 1, 0, ' ', "&CSQL(dteNOW)&", "&CSQL(dteNOW)&", "&blnShowIT&")" Set rsLogin = cnPILOT.Execute(strSQL) Set rsLogin = Nothing If NEWSLETTER = "on" Then Call AddNewsLetterRecipient(EMail) 'Send an email MailBody = BILL_FNAME&"," &vbCrLf&vbCrLf MailBody = MailBody & "Welcome and thank you for creating a "&g("COMPANY_NAME")&" eAccount." MailBody = MailBody &vbCrLf&vbCrLf MailBody = MailBody & "Your "&g("COMPANY_NAME")&" gateway page can be reached here:" &vbCrLf MailBody = MailBody & g.HomePageURL &"gateway"&vbCrLf&vbCrLf MailBody = MailBody & "Your username and password are:" &vbCrLf MailBody = MailBody & EMAIL &" / "&PWORD&vbCrLf MailBody = MailBody &vbCrLf&vbCrLf MailBody = MailBody & "Please store your password in a safe place and change it often." &vbCrLf Dim FromArray(1), ToArray(1), BCCArray(1) FromArray(0) = g("COMPANY_NAME")&" eAccount Sign Up" FromArray(1) = g("EMAIL1") ToArray(0) = BILL_FNAME&" "&BILL_LNAME ToArray(1) = EMAIL BCCArray(0) = g("COMPANY_NAME")&" eAccount Registration" BCCArray(1) = g("EMAIL1") ' Response.Write MailBody SendEMail FromArray, ToArray, 0, BCCArray, "text/plain", g("COMPANY_NAME")&" eAccount Registration", MailBody, 3 If NOT g("ALLOW_CREATE_ACCT_ACTIVATE") Then CustomerLogin email, pword Response.Redirect g.SecureURL&"gateway.asp" Else Response.Write "



Your account has been created. When a site administrator enables your account, you will be allowed to login.




" End If Else Response.Write "



Somebody had already chosen that email address.
Try to login or click back and pick a new email address.




" End If Else Response.Write "



Please fill out all required fields.
Click the back button to return to the form.




" End If Else If NOT g("ALLOW_CREATE_ACCT") Then Response.Redirect "gateway.asp" TemplateBeforePC Response.Write"" Response.Write"" CreateTextField "*First Name", BILL_FNAME, "FNAME", "maxlength=250", True, "Contact's first name", False, "" CreateTextField "*Last Name", BILL_LNAME, "LNAME", "maxlength=250", True, "Contact's last name", False, "" CreateTextField "Title", BILL_TITLE, "TITLE", "maxlength=250", False, "Your Title", False, "" CreateTextField "Company", BILL_COMPANY, "COMPANY", "maxlength=250", False, "Name of your employer", False, "" CreateTextField "*Address", BILL_ADDR1, "ADDRESS1", "maxlength=250", False, "Street address", False, "" CreateTextField "", BILL_ADDR2, "ADDRESS2", "maxlength=250", False, "Bldg. #, Apartment #, PO Box #, etc.", False, "" CreateTextField "*City", BILL_CITY, "CITY", "maxlength=250", False, "City", False, "" Response.Write "" CreateTextField "*Zip Code", BILL_ZIP, "ZIP", "maxlength=50", False, "Zip Code", False, "" Response.Write "" CreateTextField "Phone", BILL_PHONE, "PHONE", "maxlength=50", False, "Telephone number", False, "" CreateHRBreak Response.Write "" CreateTextField "*Email", EMAIL, "EMAIL", "maxlength=250", False, "Contact's Email Address", False, "" CreateTextField "*Password", PWord, "PWORD", "maxlength=250", False, "Password for My Account access", False, "" CreateHRBreak Response.Write "" Response.Write "" Response.Write "" Response.Write "
Create your Account
*"&UCase(Left(g("STATE_TYPE"), 1))&LCase(Right(g("STATE_TYPE"), Len(g("STATE_TYPE")) - 1))&"" Set rs2 = cnPILOT.Execute("SELECT CODE, STATE FROM TBLSTATES ORDER BY CODE ASC;") If Not rs2.EOF Then Response.Write"-Select your "&UCase(Left(g("STATE_TYPE"), 1))&LCase(Right(g("STATE_TYPE"), Len(g("STATE_TYPE")) - 1))&" (if applicable)" Else Response.Write"No "&UCase(Left(g("STATE_TYPE"), 1))&LCase(Right(g("STATE_TYPE"), Len(g("STATE_TYPE")) - 1))&"'s entered yet!" End If Response.Write"
*Country" Set rs2 = cnPILOT.Execute("SELECT CODE3, CODE2, Country FROM TBLCOUNTRIES ORDER BY Country ASC;") If Not rs2.EOF Then Response.Write"-Select the Country" Else Response.Write"No Countries entered yet!" End If rs2.Close: Set rs2 = Nothing Response.Write"
This will be your login username and password as well as your contact email address.
Sign Up For Our Newsletter?-Would you like to sign up for our newsletter?
Click to submit request
« Click here to CANCEL and return home.
" End If Else If Not IsLoggedIn() Then mode = "login" If mode = "" Then B2BCheckLogin "gateway" Set rs = GetCurrentCustomerRS() Response.Write "Welcome to the Gateway section of the "&g("COMPANY_NAME")&" website. We hope to provide you with simple access to all of your information. From the links below you can edit your eAccount, view current and past orders, edit your address book or contact support. From our support page you can contact sales, customer service or one of our specialists to assist you. Please select your destination from the menu below:" Response.Write "


Click here to Logout

" rs.Close: Set rs = Nothing ElseIf mode = "login" Then TemplateBeforePC DisplayLogin g.SecureURL & "gateway.asp?mode=login", g.SecureURL & "pilot.asp?pg="&g("B2B_HOMEPAGE") ElseIf mode = "orderstatus" Then B2BCheckLogin "gateway" Response.Write"Here are the orders which we currently have on file for you. If you are having problems of any kind, please feel free to contact us direct. Thank you!Return to My Account..

" ElseIf mode = "editaccount" Then Set rs = GetCurrentCustomerRS() B2BCheckLogin "gateway" Response.Write"" Response.Write"" CreateTextField "*First Name", rs("FNAME"), "FNAME", "maxlength=250", True, "Contact's first name", False, "" CreateTextField "*Last Name", rs("LNAME"), "LNAME", "maxlength=250", True, "Contact's last name", False, "" CreateTextField "Title", rs("TITLE"), "TITLE", "maxlength=250", False, "Your Title", False, "" CreateTextField "Company", rs("COMPANY"), "COMPANY", "maxlength=250", False, "Name of your employer", False, "" CreateTextField "Address", rs("ADDRESS1"), "ADDRESS1", "maxlength=250", False, "Street address", False, "" CreateTextField "", rs("ADDRESS2"), "ADDRESS2", "maxlength=250", False, "Bldg. #, Apartment #, PO Box #, etc.", False, "" CreateTextField "City", rs("CITY"), "CITY", "maxlength=250", False, "City", False, "" Response.Write "" CreateTextField "Zip Code", rs("ZIP"), "ZIP", "maxlength=50", False, "Zip Code", False, "" Response.Write "" CreateTextField "Phone", rs("PHONE"), "PHONE", "maxlength=50", False, "Telephone number", False, "" CreateHRBreak Response.Write "" CreateTextField "Email", rs("EMAIL"), "EMAIL", "maxlength=250", False, "Contact's Email Address", False, "" CreateTextField "Password", rs("PWord"), "PWORD", "maxlength=250", False, "Password for ControlPanel/My Account access", False, "" Response.Write "" Response.Write "" Response.Write "
Edit your Account
"&UCase(Left(g("STATE_TYPE"), 1))&LCase(Right(g("STATE_TYPE"), Len(g("STATE_TYPE")) - 1))&"" Set rs2 = cnPILOT.Execute("SELECT CODE, STATE FROM TBLSTATES ORDER BY CODE ASC;") If Not rs2.EOF Then Response.Write"-Select your "&UCase(Left(g("STATE_TYPE"), 1))&LCase(Right(g("STATE_TYPE"), Len(g("STATE_TYPE")) - 1))&" (if applicable)" Else Response.Write"No "&UCase(Left(g("STATE_TYPE"), 1))&LCase(Right(g("STATE_TYPE"), Len(g("STATE_TYPE")) - 1))&"'s entered yet!" End If Response.Write"
*Country" Set rs2 = cnPILOT.Execute("SELECT CODE3, CODE2, Country FROM TBLCOUNTRIES ORDER BY Country ASC;") If Not rs2.EOF Then Response.Write"-Select the Country" Else Response.Write"No Countries entered yet!" End If rs2.Close: Set rs2 = Nothing Response.Write"
Editing these may require you to login again.
Click to submit changes
« Click here to CANCEL and return home.
" ElseIf mode = "editaddressbook" Then B2BCheckLogin "gateway" Response.Write"" Response.Write"" specific = Request.QueryString("specific") If specific&"X"="X" Then specific = Request.Form("AddressBookSpecific") DisplayEditAddressBook(specific) Response.Write "" Response.Write "" Response.Write "" Response.Write "
Edit your Address Book
Click to submit changes
« Click here to CANCEL and return home.
« Click here to Delete this record and return home.
" ElseIf mode = "updateacct" Then B2BCheckLogin "gateway" strEMail = EStr(Request.Form("EMail")) strPassword = EStr(Request.Form("PWord")) If IsEmpty(strEMail) Or IsEmpty(strPassword) Then Response.Write "



Both email & password must be entered!

Click here to contact us...



" Else Set rsU = OpenUpdateableRS("SELECT * FROM tblLogins WHERE CustID " & CSQLEq(cid)) If HasRecords(rsU) Then lngContactID = rsU("ContactID") rsU("EMail") = strEMail rsU("PWord") = strPassword rsU.Update rsU.Close: Set rsU = Nothing Set rsU = OpenUpdateableRS("SELECT * FROM tblContacts WHERE ContactID " & CSQLEq(lngContactID)) rsU("FNAME") = EStr(Request.Form("FNAME")) rsU("LNAME") = EStr(Request.Form("LNAME")) rsU("TITLE") = EStr(Request.Form("TITLE")) rsU("COMPANY") = EStr(Request.Form("COMPANY")) rsU("Address1") = EStr(Request.Form("Address1")) rsU("Address2") = EStr(Request.Form("Address2")) rsU("City") = EStr(Request.Form("City")) rsU("State") = EStr(Request.Form("State")) rsU("Zip") = EStr(Request.Form("Zip")) rsU("Country") = EStr(Request.Form("Country")) rsU("Phone") = EStr(Request.Form("Phone")) rsU.Update Response.Write "



Successful!

Click here to return home...



" Else Response.Write "



Failed!

Click here to contact us...



" End If rsU.Close: Set rsU = Nothing End If ElseIf mode = "updateaddressbook" Then B2BCheckLogin "gateway" ErrorMsg = "" specific = Request.QueryString("AddressBookSpecific") If specific&"X" = "X" Then specific = Request.Form("AddressBookSpecific") Set rs = GetCurrentCustomerRS() custID = rs("CUSTID") contactID = Request.Form("contactID") rs.Close : Set rs = Nothing FNAME = Replace(EStr(Request.Form("FNAME")), "'", "''") LNAME = Replace(EStr(Request.Form("LNAME")), "'", "''") TITLE = Replace(EStr(Request.Form("TITLE")), "'", "''") COMPANY = Replace(EStr(Request.Form("COMPANY")), "'", "''") Address1 = Replace(EStr(Request.Form("Address1")), "'", "''") Address2 = Replace(EStr(Request.Form("Address2")), "'", "''") City = Replace(EStr(Request.Form("City")), "'", "''") State = Replace(EStr(Request.Form("State")), "'", "''") Zip= Replace(EStr(Request.Form("Zip")), "'", "''") Country = Replace(EStr(Request.Form("Country")), "'", "''") Phone = Replace(EStr(Request.Form("Phone")), "'", "''") Email = Replace(EStr(Request.Form("EMAIL")), "'", "''") NICKNAME = Replace(EStr(Request.Form("NICKNAME")), "'", "''") If FName="" OR LName="" OR Zip="" OR Country="" Then ErrorMsg = "



Please fill out all required fields.
Click back to try again.




" Elseif NOT ValidEmailAddress(Email) Then ErrorMsg = "



Please check that your email address is valid.
Click back to try again.




" Else If specific = "new" OR specific="-1" Then strSQL = "SELECT * FROM TBLADDRESSBOOK WHERE NICKNAME='"&NICKNAME&"' AND LOGINID="&custID Set rsABCK = cnPILOT.Execute(strSQL) If rsABCK.EOF Then If Not UpdateAddressBook(specific, custID, FNAME, LNAME, TITLE, COMPANY, Address1, Address2, City, State, Zip, Country, Phone, Email, NICKNAME, True) Then ErrorMsg = "



Error Updating Your Address Book




" End If Else ErrorMsg = "



That Nick Name Already Exists

Please Click Back And Enter A New Nick Name...

Or click here to view your cart




" End If rsABCK.Close : Set rsABCK = Nothing Else 'Update the existing record blnNew=True If specific&"X"<>"-1X" AND specific&"X"<>"X" Then specific = Cint(specific) If contactID&"X"<>"X" Then contactID = Cint(contactID) blnNew=False End If strSQL = "SELECT * FROM TBLADDRESSBOOK WHERE NICKNAME='"&NICKNAME&"' AND ID <>"&specific&" AND LOGINID="&custID Set rsABCK = cnPILOT.Execute(strSQL) If rsABCK.EOF Then If Not UpdateAddressBook(specific, contactID, FNAME, LNAME, TITLE, COMPANY, Address1, Address2, City, State, Zip, Country, Phone, Email, NICKNAME, blnNew) Then ErrorMsg = "



Error Updating Your Address Book




" End If Else ErrorMsg = "



That Nick Name Already Exists

Please Click Back And Enter A New Nick Name...

Or click here to view your cart




" End If rsABCK.Close : Set rsABCK = Nothing End If End If 'If there is a target in the QueryString, then it is coming from Check out process If Request.QueryString("target")="cart" Then NewCrtID = Request.QueryString("nwcrid") If ErrorMsg = "" Then Response.Redirect "cart.asp" End If 'If there isn't a target, back home to the gateway If ErrorMsg = "" Then Response.Redirect "gateway.asp?mode=addressbook" Response.Write ErrorMsg ElseIf mode = "addressbook" Then B2BCheckLogin "gateway" blnHasAddresses = False Set rs = GetCurrentCustomerRS() Set rsAB = cnPILOT.Execute("Select ID, NICKNAME From TBLADDRESSBOOK Where LOGINID = "&rs("CUSTID")&" Order By NICKNAME asc") If NOT rsAB.EOF Then arrAddressBook = rsAB.getRows blnHasAddresses = True End If rsAB.Close Set rsAB = Nothing If blnHasAddresses Then Response.Write "Pick the entry your wish to edit then click next, " _ & "or create a new address.." _ & "
" DisplayAddressBook cid, False Response.Write "
" _ & "Return to My Account..

" Else Response.Write "



Your address book is currently empty, " _ & "to create a new address click here




" End If ElseIf mode = "download" Then B2BCheckLogin "gateway" Set rs = GetCurrentCustomerRS() If Not rs("Reseller") Then Response.Redirect "gateway.asp" Set rsI = cnPILOT.Execute("Select ItemName, ItemID From tblInventory Where Download_Filename <> '' Order By ItemName") Response.Write "Here you can find our library of downloadable software products:Return to My Account..

" rs.Close: Set rs = Nothing Elseif mode = "delete" Then specific = Request.QueryString("specific") If specific&"X"<>"X" AND specific<>"new" Then strSQL = "DELETE FROM TBLADDRESSBOOK WHERE ID=" & specific cnPILOT.Execute strSQL, , adCmdText Or adExecuteNoRecords End If Response.Redirect "gateway.asp?mode=addressbook" ElseIf mode = "logout" Then CustomerLogout B2BCheckLogin "gateway" Response.Write"




You have been successfully logged out.
"&_ "
To login again, please click here,
or click here to return home..



" Else Response.Write "That mode is invalid." End If End If 'Ending the create new account if TemplateAfterPC PilotPageEnd %>