<% option explicit %> <% '--- vars -------------------------------------------------------- dim problem '--- subs and fns -------------------------------------------------------- sub AddToProblem(errorMsg) if problem = "" then problem = "Sorry, you have not supplied all required information.
Please note the following:

" end if problem = problem & errorMsg & "
" end sub function IsValidEmail(theAddress) dim countTheAts, i dim Tools IsValidEmail = true ' must be more than 5 chars - i.e "a@b.c" if len(theAddress) < 5 then IsValidEmail = false else ' has at least one "." if instr(theAddress,".") <= 0 then IsValidEmail = false else ' has only one "@" countTheAts = 0 i = 1 while i <= len(theAddress) if mid(theAddress,i,1) = "@" then countTheAts = countTheAts + 1 end if i = i + 1 wend if countTheAts <> 1 then IsValidEmail = false else 'check each char is valid i = 1 while i <= len(theAddress) if not isnumeric(mid(theAddress,i,1)) and _ (lcase(mid(theAddress,i,1)) < "a" or _ lcase(mid(theAddress,i,1)) > "z") and _ mid(theAddress,i,1) <> "_" and _ mid(theAddress,i,1) <> "." and _ mid(theAddress,i,1) <> "@" and _ mid(theAddress,i,1) <> "-" then IsValidEmail = false end if i = i + 1 wend end if end if end if end function sub CheckForProblems() if Request("name") = "" then AddToProblem("Name.") end if if Request("email") = "" then AddToProblem("Email address.") else if not IsValidEmail(Request("email")) then AddToProblem("Email address appears invalid.") end if end if end sub function requestDetails() dim EmailMsg EmailMsg = EmailMsg & "Website Enquiry" EmailMsg = EmailMsg & vbCrLf & vbCrLf & "Name : " & Request("name") EmailMsg = EmailMsg & vbCrLf & "Company : " & Request("company") EmailMsg = EmailMsg & vbCrLf & "Address: " & Request("address") EmailMsg = EmailMsg & vbCrLf & "Phone: " & Request("phone") EmailMsg = EmailMsg & vbCrLf & "Email: " & Request("email") if Request("newhouse") <> "" then EmailMsg = EmailMsg & vbCrLf & "New House selected" end if if Request("reroof") <> "" then EmailMsg = EmailMsg & vbCrLf & "Re-roof selected" end if if Request("commercial") <> "" then EmailMsg = EmailMsg & vbCrLf & "Commercial selected" end if if Request("corrugate") <> "" then EmailMsg = EmailMsg & vbCrLf & "Corrugate selected" end if if Request("6rib") <> "" then EmailMsg = EmailMsg & vbCrLf & "Six Rib selected" end if if Request("5rib") <> "" then EmailMsg = EmailMsg & vbCrLf & "Five Rib selected" end if if Request("rainwater") <> "" then EmailMsg = EmailMsg & vbCrLf & "Rainwater selected" end if if Request("dont") <> "" then EmailMsg = EmailMsg & vbCrLf & "Not interested in receiving additional information" end if requestDetails = EmailMsg end function '--- main code -------------------------------------------------------- dim Tools if Request("action") = "check" then response.write(trim(Request("text")) +","+ trim(Session("text"))) if trim(Request("text")) = trim(Session("text")) then CheckForProblems if problem = "" then Response.buffer = True '--- vars for email booking ------------------------------------------------- 'ToAddress : email will be sent to this address 'FromAddress : error messages from smtp server will be sent to this address 'SubjectHeader : Subject line. dim ToAddress, FromAddress, SubjectHeader, Email ToAddress = "sales@freemanroofing.co.nz" FromAddress = Request("email") SubjectHeader = "Freeman Website Enquiry" 'send the email. Set Email = Server.CreateObject("CDONTS.NewMail") Email.From = FromAddress Email.To = ToAddress Email.Subject = SubjectHeader Email.Body = requestDetails Email.Send Set Email = nothing Response.clear Response.redirect "thanks.htm" end if end if else //Set Tools = Server.CreateObject("MSWC.Tools") //Session("text") = Abs(Tools.Random) end if %> Freeman Roofing
Contact and Links Submit an Enquiry Gallery Freeman Roofing Homepage



" <%=Session("text")%>> <% if Request("action") <> "" then %> <%=problem%> <% end if %>
E N Q U I R Y F O R M
*NAME: ">
*COMPANY: ">
*ADDRESS: ">
*PHONE: ">
*EMAIL: ">

I WOULD LIKE INFORMATION
ON:

Product Type:
CORRUGATE
SIX RIB
New house FIVE RIB
Re-Roof MULTI RIB
Commercial RAINWATER

* Required Fields
I do not wish to receive further information on Freeman Roofing Products or Services