%@ Language=VBScript %> <% Option Explicit %> <% 'Const ORGANISER_EMAIL = "marywilson@confluenceevents.co.uk" Const ORGANISER_EMAIL = "graeme@active-answer.co.uk" Const ORGANISER_COMPANY = "Confluence Events web enquiry" Const MAILHOST = "smtpmail" 'Const MAILHOST = relay.hostinguk.net Const FM_ENTER = 0 ' Enter the form Const FM_CHECK = 1 ' Checking contents Const FM_EMAIL_SENT = 2 ' Email has been sent Const FM_EMAIL_ERROR = 3 ' Error Sending Email Const FM_FORM_ERROR = 4 ' Error in the form ' Check on the form mode Dim FMode ' Form Mode Dim NxMode ' Next Form Mode Dim Name ' Name on form Dim Email ' Email on form Dim Tel ' Telephone on form Dim Comp ' Company name on the form Dim PostCode ' Postcode on the form Dim Enquiry ' Company on the form Dim Title ' title Dim Surname ' Surname Dim Comptitle ' Company titel Dim CompAddOne ' Contact Address One Dim CompAddTwo ' Contact Address Two Dim CompAddThree ' Contact Address Three Dim CompAddFour ' Contact Address Four Dim CompAddFive 'Contact Address Five Dim ContactEmail ' Contact Email Dim ContactTel ' Contact Telephone Dim ContactPost ' Contact Post Dim FindOut 'dropFindOut Dim HowFindOutText 'dropFind TextBox Dim EventsDinners 'Events Awards and Dinners check box Dim EventsConference ' Events Meetings and confreences check box Dim EventsSummerParties ' Events Summer Parties check box Dim EventsChristmasParties ' Event Chritsmas parties check box Dim EventsCorpHospitality ' Event Corporate hospitiality check box Dim EventRestaurant ' Event Restaurant and private room bookings check box Dim EventTeamBuilding ' Event Team Building and Activities check box Dim EventProductLaunch ' Event Product Launch check box Dim EventOther ' Event Other Text box Dim OrganisePerYear ' Events orgainsised per year Drop Down box Dim EventParties ' Events Parties check box Dim LocationLondon ' Location City of London check box Dim CentralLondon ' Location Other Central London check box Dim WithinM25 ' Location Within M25 check box Dim ThroughoutUK ' Location Throughout UK check box Dim Regions ' Location Scotland, Wales, Ireland check box Dim OverSeas ' Location Overseas check box Dim EnquiryYearly ' Nature of Enquiry : yearly event management check box Dim EnquiryOneOff ' Nature of Enquiry : one off event management check box Dim Specialist ' Nature of Enquiry : Specialist check box Dim eMsg ' Error Message Dim dbConn1, rs1 ' Database Access Data ' ********************************** ' Checks for a valid email address ' ' Returns: true email address is good ' false email address is bad ' ********************************** Function checkEmail(emStr) Dim r1, r2 ' Regular expression objects Set r1 = new RegExp r1.Pattern = "(@.*@)|(\.\.)|(@\.)|(^\.)" Set r2 = new RegExp r2.Pattern = "^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$" If Not(r1.Test(emStr)) and r2.Test(emStr) Then checkEmail = true Else checkEmail = false End If End Function ' ******************************** ' Read the form details ' ******************************** Sub ReadForm() Name = Request.Form("txtName") Comp = Request.Form("txtCompany") Tel = Request.Form("txtTel") Email = Request.Form("txtEmail") Enquiry = Request.Form("txtEnquiry") PostCode = Request.Form("txtPostCode") Title = Request.Form("txtTitle") Surname = Request.Form("txtSurname") Comptitle= Request.Form("txtCompTitle") CompAddOne = Request.Form("txtCompanyOne") CompAddTwo = Request.Form("txtCompanyTwo") CompAddThree = Request.Form("txtCompanyThree") CompAddFour = Request.Form("txtCompanyFour") CompAddFive = Request.Form("txtCompanyFive") ContactEmail = Request.Form("chkSendEmail") ContactTel = Request.Form("chkSendTel") ContactPost = Request.Form("chkSendPost") FindOut = Request.Form("dropFindOut") HowFindOutText = Request.Form("txtHowFindOut") EventsDinners = Request.Form("chkEventsDinners") EventsConference = Request.Form("chkEventsConference") EventsSummerParties = Request.Form("chkEventsSummerParties") EventsChristmasParties = Request.Form("chkEventsChristmasParties") EventsCorpHospitality = Request.Form("chkEventsCorpHospitality") EventRestaurant = Request.Form("chkEventRestaurant") EventTeamBuilding = Request.Form("chkEventTeamBuilding") EventProductLaunch = Request.Form("chkEventProductLaunch") EventParties = Request.Form("chkEventParties") EventOther = Request.Form("txtEventOther") OrganisePerYear = Request.Form("dropPerYear") LocationLondon = Request.Form("chkLocationLondon") CentralLondon = Request.Form("chkCentralLondon") WithinM25 = Request.Form("chkWithinM25") ThroughoutUK = Request.Form("chkThroughoutUK") Regions = Request.Form("chkRegions") OverSeas = Request.Form("chkOverSeas") EnquiryYearly = Request.Form("chkEnquiryYearly") EnquiryOneOff = Request.Form("chkEnquiryOneOff") Specialist = Request.Form("chkSpecialist") End Sub ' ************************************************************ ' Attempts to store the client data in a cookie dictionary ' ************************************************************ Sub fetchClientInfo ' ******************************* ' Check if the cookies exist ' ******************************* If Request.Cookies("Confluence Events").HasKeys() = True Then Name = Request.Cookies("Confluence Events")("Name") Comp = Request.Cookies("Confluence Events")("Comp") Tel = Request.Cookies("Confluence Events")("Tel") Email = Request.Cookies("Confluence Events")("Email") PostCode = Request.Cookies("Confluence Events")("PostCode") Title = Request.Cookies("Confluence Events") ("Title") Surname = Request.Cookies("Confluence Events")("Surname") Comptitle= Request.Cookies("Confluence Events")("Comptitle") CompAddOne = Request.Cookies("Confluence Events")("CompAddOne") CompAddTwo = Request.Cookies("Confluence Events")("CompAddTwo") CompAddThree = Request.Cookies("Confluence Events")("CompAddThree") CompAddFour = Request.Cookies("Confluence Events")("CompAddFour") CompAddFive = Request.Cookies("Confluence Events")("CompAddFive") ContactEmail = Request.Cookies("Confluence Events")("ContactEmail") ContactTel = Request.Cookies("Confluence Events")("ContactTel") ContactPost = Request.Cookies("Confluence Events")("ContactPost") FindOut = Request.Cookies("Confluence Events")("FindOut") HowFindOutText = Request.Cookies("Confluence Events")("HowFindOutText") EventsDinners = Request.Cookies("Confluence Events")("EventsDinners") EventsConference = Request.Cookies("Confluence Events")("EventsConference") EventsSummerParties = Request.Cookies("Confluence Events")("EventsSummerParties") EventsChristmasParties = Request.Cookies("Confluence Events")("EventsChristmasParties") EventsCorpHospitality = Request.Cookies("Confluence Events")("EventsCorpHospitality") EventRestaurant = Request.Cookies("Confluence Events")("EventRestaurant") EventTeamBuilding = Request.Cookies("Confluence Events")("EventTeamBuilding") EventProductLaunch = Request.Cookies("Confluence Events")("EventProductLaunch") EventParties = Request.Cookies("Confluence Events")("EventParties") EventOther = Request.Cookies("Confluence Events")("EventOther") OrganisePerYear = Request.Cookies("Confluence Events")("OrganisePerYear ") Enquiry = Request.Cookies("Confluence Events")("Enquiry") LocationLondon = Request.Cookies("Confluence Events")("LocationLondon") CentralLondon = Request.Cookies("Confluence Events")("CentralLondon") WithinM25 = Request.Cookies("Confluence Events")("WithinM25") ThroughoutUK = Request.Cookies("Confluence Events")("ThroughoutUK") Regions = Request.Cookies("Confluence Events")("Regions") OverSeas = Request.Cookies("Confluence Events")("OverSeas") EnquiryYearly = Request.Cookies("Confluence Events")("EnquiryYearly") EnquiryOneOff = Request.Cookies("Confluence Events")("EnquiryOneOff") Specialist = Request.Cookies("Confluence Events")("Specialist") End If End Sub ' ******************************* ' check the values on the form ' ******************************* Function checkForm() eMsg = "" 'If Len(Name) = 0 Then 'emsg = emsg & wrErr("Please enter your name.") ' End If ' If Len(Enquiry) = 0 Then ' emsg = emsg & wrErr("Please enter some enquiry details.") ' End If If checkEmail(Email) = False Then emsg = emsg & wrErr("Please enter a valid email address.") End If If Len(Emsg) > 0 then checkForm = False Else checkForm = True End If End Function ' ***************************************** ' Format the error code ' ***************************************** Function wrErr(Str) wrErr = "