%
dim testArray(10)
testArray(0) = ""
testArray(1) = "href"
testArray(2) = "javascript"
testArray(3) = "viagra"
testArray(4) = ".html"
testArray(5) = ".js"
testArray(6) = ".php"
testArray(7) = ".asp"
testArray(8) = "http://"
testArray(9) = "https://"
function TestCaptcha(byval valSession, byval valCaptcha)
dim tmpSession
valSession = Trim(valSession)
valCaptcha = Trim(valCaptcha)
if (valSession = vbNullString) or (valCaptcha = vbNullString) then
TestCaptcha = false
else
tmpSession = valSession
valSession = Trim(Session(valSession))
Session(tmpSession) = vbNullString
if valSession = vbNullString then
TestCaptcha = false
else
valCaptcha = Replace(valCaptcha,"i","I")
if StrComp(valSession,valCaptcha,1) = 0 then
TestCaptcha = true
else
TestCaptcha = false
end if
end if
end if
end function
Function quoteFix(text)
dim temptext
if isNull(text) then
quoteFix = ""
else
temptext = replace(text, "´", "'")
temptext = replace(temptext, "´", "'")
temptext = Replace(temptext, Chr(34),""")
temptext = Replace(temptext,"<","<")
temptext = Replace(temptext,">",">")
temptext = Replace(temptext,"&","&")
quoteFix = temptext
end if
end Function
'*** other email validator
'VALIDATE EMAIL
Function CheckIsEmail(strEmailAddress)
Set strRegExp = New RegExp
strRegExp.Pattern ="^(([^<>()[\]\\.,;:\s@""]+(\.[^<>()[\]\\.,;:\s@""]+)*)|("".+""))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$"
strRegExp.IgnoreCase = true
CheckIsEmail = strRegExp.Test(strEmailAddress)
End Function
if Request.Form("Process") = "Yes" then
errMsg = ""
'test for completeness
if errMsg = "" then
if Trim(Request.Form("Company_Name")) = "" then errMsg = errMsg & "
You did not fill in the company name."
if Trim(Request.Form("Business_Contact")) = "" then errMsg = errMsg & "You did not fill in your name."
if Trim(Request.Form("email")) = "" then errMsg = errMsg & "You did not fill in your email address."
if Trim(Request.Form("Business_Phone")) = "" then errMsg = errMsg & "You did not fill in your phone number."
end if
'test email address
if errMsg = "" then
if CheckIsEmail(Request.Form("email")) = "False" then errMsg = errMsg & "Not a valid email address."
end if
' test captcha
if Not TestCaptcha("ASPCAPTCHA", Request.Form("captchacode")) then
errMsg = "You did not enter the code correctly."
end if
'test question contents
if errMsg = "" then
msgTest = "no"
for x = 0 to 9
if inStr(Request.Form("Business_Description"), testArray(x)) then msgTest = "yes"
next
if msgTest = "yes" then errMsg = errMsg & "There is questionable content in your comments. Please reword and submit again."
end if
if errMsg = "" then
'Create the mail object
Set objMail = Server.CreateObject("CDO.Message")
'Set email server variables
objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.daalibaba.com"
'Server port (typically 25)
objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'Server Authenication
objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
'Server User
objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "fryer@daalibaba.com"
'Server Password
objMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "jps6430"
objMail.Configuration.Fields.Update
'Set key properties
if Request.Form("email") = "" then
objMail.From = "info@mantuashalersvillechamber.com"
else
objMail.From = Request.Form("email")
end if
objMail.To = "jpsdg@suite224.net,communityjournal@yahoo.com" '
objMail.Subject= "MSACC Membership Application"
sTextBody = ""
sTextBody = sTextBody & "Company: " & quoteFix(Request.Form("Company_Name")) & chr(10) & chr(13)
sTextBody = sTextBody & "Location: " & quoteFix(Request.Form("Location")) & chr(10) & chr(13)
sTextBody = sTextBody & "Location2: " & quoteFix(Request.Form("Location2")) & chr(10) & chr(13)
sTextBody = sTextBody & "Mailing Address: " & quoteFix(Request.Form("Mailing_Address1")) & chr(10) & chr(13)
sTextBody = sTextBody & "Mailing Address2: " & quoteFix(Request.Form("Mailing_Address2")) & chr(10) & chr(13)
sTextBody = sTextBody & "Phone Number: " & quoteFix(Request.Form("Business_Phone")) & chr(10) & chr(13)
sTextBody = sTextBody & "Fax Number: " & quoteFix(Request.Form("Business_Fax")) & chr(10) & chr(13)
sTextBody = sTextBody & "Email Address: " & quoteFix(Request.Form("email")) & chr(10) & chr(13)
sTextBody = sTextBody & "Name: " & quoteFix(Request.Form("Business_Contact")) & chr(10) & chr(13)
sTextBody = sTextBody & "Title: " & quoteFix(Request.Form("Business_Contact_Title")) & chr(10) & chr(13)
sTextBody = sTextBody & "Type of Business: " & quoteFix(Request.Form("Type_of_Business")) & chr(10) & chr(13)
sTextBody = sTextBody & "No of Employees: " & quoteFix(Request.Form("No_of_Employees")) & chr(10) & chr(13)
sTextBody = sTextBody & "Secondary Contact: " & quoteFix(Request.Form("Secondary_Contact_Name")) & chr(10) & chr(13)
sTextBody = sTextBody & "Website: " & quoteFix(Request.Form("WebSite_Link")) & chr(10) & chr(13)& chr(10) & chr(13)
sTextBody = sTextBody & "Business Description: " & quoteFix(Request.Form("Business_Description")) & chr(10) & chr(13)
objMail.TextBody = sTextBody
'Send the email
objMail.Send
'Clean-up mail object
Set objMail = Nothing
end if
end if
%>