%option explicit%>
<%
dim my_to, my_toaddress,my_system,my_from,my_fromaddress,my_subject,mailtype
dim mailer, my_attachment
dim customeradmin
'VP-ASP 6.09 - adjust to time difference, if required
dim newdate, newtime
'**********************************************************
' adds customer Contact form
' Display compnay information and allows customer to send messages
'
' Version 6.50 Nov 11, 2005
'*********************************************************
Dim sAction, dbtable
Dim strPassword1, strPassword2
dim body, strsubject,strcomment
setsess "currenturl","shopcustcontact.asp"
sAction=Request("Action")
if saction="" then
sAction=Request("Action.x")
end if
If getconfig("xcontactform")<>"Yes" then
shoperror getlang("LangCustNotAllowed")
end if
Serror=""
ShopPageHeader
'VP-ASP 6.09 - added breadcrumb / VP-ASP 6.50 - added config option to turn breadcrumb on/off
if getconfig("xbreadcrumbs") = "Yes" then
response.write "
"
end if
If sAction = "" Then
DisplayForm
Else
ValidateData()
if sError = "" Then
SendMailToMerchant strsubject
WriteInfo
DisplayCompanyinfo
else
DisplayForm
end if
end if
ShopPageTrailer
Sub DisplayForm()
Displayerrors
DisplayMinimumForm
DisplayCompanyinfo
End Sub
Sub ValidateData
'VP-ASP 6.50 - precautionary security fix
strFirstname = cleanchars(Request.Form("strFirstname"))
strLastname = cleanchars(Request.Form("strLastname"))
strEmail = cleanchars(Request.Form("strEmail"))
strcomment=cleanchars(request("strcomment"))
strsubject=cleanchars(request("strsubject"))
strcompany=cleanchars(request("strcompany"))
ValidateMininumInfo
End Sub
Sub WriteInfo
%>
<%=getlang("LangTellaFriendInfo")%>
|
<%=getlang("langyourname")%> |
<%=strFirstname%>
|
|
<%=getlang("langloginemail")%> |
<%=strEmail%>
|
|
<%=getlang("langsubject")%> |
<%=strSubject%>
|
|
<%=getlang("langmenucomment")%> |
<%=replace(strcomment, chr(13), " ")%> |
|
|
<%
End Sub
Sub DisplayErrors
if sError<> "" then
shopwriteError SError
Serror=""
end if
end Sub
Sub SendMailToMerchant (isubject)
dim acount
dim my_attachment, htmlformat
htmlformat="Text"
my_attachment=""
mailtype=getconfig("xemailtype")
'VP-ASP 6.08a - no lastname in form, so it wasn't showing anything
'my_from=strlastname
my_from=strfirstname & " " & strlastname
my_fromaddress=stremail
my_toaddress=getconfig("xemail")
my_to=getconfig("xemailname")
my_system=getconfig("xemailsystem")
my_subject=isubject
Body=""
'VP-ASP 6.09 - adjust to time difference, if required
'body=body & shopdateformat(date(),getconfig("xdateformat")) & " " & time()& vbcrlf & vbcrlf
If getconfig("xTimeDifference")="" then
newDate = Date()
newTime = Time()
else
adjustdate newDate
adjusttime newTime
end if
body=body & shopdateformat(newdate,getconfig("xdateformat")) & " " & newtime & vbcrlf & vbcrlf
Body=Body & Strfirstname & " " & strLastname & vbcrlf
Body=body & stremail & vbcrlf
if strcompany<>"" then
Body=body & getlang("LangCustcompany") & " " & strcompany & vbcrlf
end if
body=body & vbcrlf
body=body & strcomment
acount=0
ExecuteMail mailtype,My_from,my_fromaddress,my_to,my_toaddress,my_subject,body,htmlformat,my_attachment,acount
If getconfig("xdebug")="Yes" then
debugwrite "Mailing to: " & my_to & "(" & my_toaddress & ") from " & strlastname & " " & stremail
end if
end sub
Sub DisplayMinimumForm
%>
<%=getlang("langcontactus")%>
<%
end sub
Sub ValidateMininumInfo
If strFirstname = "" Then
sError = sError & getlang("LangCustFirstname") & getlang("LangCustrequired") & "
"
End If
If strEmail = "" Then
sError = sError & getlang("LangCustEmail") & getlang("LangCustrequired") & "
"
Else
CustomerValidateEmail stremail
end If
If strSubject = "" Then
sError = sError & getlang("LangSubject") & getlang("LangCustrequired") & "
"
End If
If strComment = "" Then
sError = sError & getlang("LangCheckoutadditional") & getlang("LangCustrequired") & "
"
End If
'VP-ASP 6.50 - add a random string to email form to stop bots spamming it
if getconfig("xprotectemailforms") = "Yes" then
%><%
If blnCAPTCHAcodeCorrect Then
'Fine
Else
sError = sError & getlang("langcaptchawrong") & "
"
End If
End if
end sub
Sub DisplaycompanyInfo
dim sql, rs, dbc, address, email, myemail
openorderdb dbc
sql="select * from mycompany"
set rs=dbc.execute(sql)
if rs.eof then
closerecordset rs
shopclosedatabase dbc
exit sub
end if
address=rs("address") & "
"
address=address & rs("city") & " " & rs("state") & " " & rs("postalcode")
address=address & "
" & rs("country")
%>
<%=getlang("langcommoninformation")%>
<%=getlang("LangCustCompany")%> |
<%=rs("companyname")%> |
<%=getlang("LangCustAddress")%> |
<%=address%> |
<%=getlang("LangCustPhone")%> |
<%=rs("phonenumber")%> |
<%=getlang("LangCustFax")%> |
<%=rs("faxnumber")%> |
<% myemail=rs("myemail")
If not isnull(Myemail) then
email="" & myemail & ""
%>
<%=getlang("LangCustEmail")%> |
<%=email%> |
<% end if %>
<%
end sub
'VP-ASP 6.50 - add a random string to email form to stop bots spamming it
Sub CreateCAPTCHA
if getconfig("xprotectemailforms") <> "Yes" then exit sub
Response.write tablerow & tablecolumn
Response.write "" & getlang("langcaptchaenter") & ""
getCAPTCHA
Response.write tablecolumnend & tableRowend
End Sub
%>