%option explicit%>
<%
dim my_to, my_toaddress,my_system,my_from,my_fromaddress,my_subject,mailtype
dim mailer, my_attachment
dim customeradmin
'**********************************************************
' adds customer Contact form
' Display compnay information and allows customer to send messages
'
' Version 4.50 Oct 31, 2002 fix close database
'*********************************************************
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 LangCustNotAllowed
end if
Serror=""
If sAction = "" Then
ShopPageHeader
DisplayForm
ShopPageTrailer
Else
ValidateData()
if sError = "" Then
SendMailToMerchant strsubject
WriteInfo
else
ShopPageHeader
DisplayForm
ShopPageTrailer
end if
end if
Sub DisplayForm()
Displayerrors
DisplayCompanyinfo
Response.Write("
"
End Sub
Sub ValidateData
strFirstname = Request.Form("strFirstname")
strLastname = Request.Form("strLastname")
strEmail = Request.Form("strEmail")
strcomment=request("strcomment")
strsubject=request("strsubject")
strcompany=request("strcompany")
ValidateMininumInfo
End Sub
Sub WriteInfo
ShoppageHeader
response.write getconfig("xfont") & LangTellaFriendInfo & "
"
ShopPageTrailer
End Sub
Sub DisplayErrors
if sError<> "" then
response.write "" & getconfig("Xfont") & SError & ""
Serror=""
end if
end Sub
Sub SendMailToMerchant (isubject)
dim acount
dim my_attachment, htmlformat
htmlformat="Text"
my_attachment=""
mailtype=getconfig("xemailtype")
my_from=strlastname
my_fromaddress=stremail
my_toaddress=getconfig("xemail")
my_to=getconfig("xemailname")
my_system=getconfig("xemailsystem")
my_subject=isubject
Body=""
body=body & shopdateformat(date(),getconfig("xdateformat")) & " " & time()& vbcrlf & vbcrlf
Body=Body & Strfirstname & " " & strLastname & vbcrlf
Body=body & stremail & vbcrlf
if strcompany<>"" then
Body=body & 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
Response.Write(TableDef)
CreateCustRow LangCustFirstname, "strfirstname", strFirstname,"Yes"
CreateCustRow LangCustLastname, "strLastname", strLastname,"Yes"
CreateCustRow LangCustEmail, "strEmail", strEmail, "Yes"
CreateCustRow LangSubject, "strsubject", strSubject, "Yes"
CreateCustRow LangCustCompany, "strcompany", strcompany, "No"
Response.Write(TableDefEnd)
Response.write "" & getconfig("xfont") & LangCheckoutadditional & "
"
end sub
Sub ValidateMininumInfo
If strFirstname = "" Then
sError = sError & LangCustFirstname & LangCustRequired & "
"
End If
If strLastname = "" Then
sError = sError & LangCustLastname & LangCustRequired & "
"
End If
If strEmail = "" Then
sError = sError & LangCustEmail & LangCustRequired & "
"
Else
CustomerValidateEmail stremail
end If
If strSubject = "" Then
sError = sError & LangSubject & LangCustRequired & "
"
End If
If strComment = "" Then
sError = sError & LangCheckoutadditional & LangCustRequired & "
"
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
Response.Write(TableDef)
'DoHeader ""
DoField LangCustCompany,rs("companyname")
address=rs("address") & "
"
address=address & rs("city") & " " & rs("state") & " " & rs("postalcode")
address=address & "
" & rs("country")
DoField LangCustAddress,address
DoField LangCustPhone,rs("phonenumber")
DoField LangCustFax,rs("faxnumber")
myemail=rs("myemail")
If not isnull(Myemail) then
email="" & myemail & ""
DoField LangCustEmail,email
end if
response.write ""
end sub
Sub DoField (fieldname,fieldvalue)
if fieldvalue="" or isNull(fieldvalue) then
exit sub
end if
Response.write ForderFieldRow
Response.write ReportDetailColumn & fieldname & ReportDetailcolumnend
Response.write Reportdetailcolumn & fieldvalue & Reportdetailcolumnend
response.write ""
end sub
'
%>