%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
' Globals
Dim mailSent
Dim frmContactName
Dim frmCompany
Dim frmEmailAdd
Dim frmTelephone
mailSent = 0
If (UCase(Request.QueryString("form_sent")) = "TRUE") Then
ProcessForm()
End If
' ----------------------------------------------------------------------
' ProcessForm()
' ----------------------------------------------------------------------
Sub ProcessForm()
Dim referer
referer = Request.ServerVariables("HTTP_REFERER")
' ------------------------------------------------------------------
' Security Measure - Check Page Referer
' ------------------------------------------------------------------
If (InStr(referer, "http://www.marinetrack.com")) Then
' --------------------------------------------------------------
' Security Measure - Check Form for Illegal Data
' --------------------------------------------------------------
If (GotIllegalData()) Then
Response.Redirect("/")
Else
frmContactName = CStr(Request.Form("name"))
frmCompany = CStr(Request.Form("company"))
frmEmailAdd = CStr(Request.Form("email"))
frmTelephone = CStr(Request.Form("telephone"))
If (CreateMessage()) Then
mailSent = 1
End If
End If
End If
End Sub
' ----------------------------------------------------------------------
' ----------------------------------------------------------------------
' CreateMessage()
' ----------------------------------------------------------------------
Function CreateMessage()
Dim msg
Dim dateTime
dateTime = Day(Now) & " " & MonthName(Month(Now)) & " " & Year(Now) & " " & Time()
Set msg = Server.CreateObject("JMail.Message") ' Create JMail object
msg.Logging = true ' Ease potential debugging
msg.silent = true ' Handle errors ourselves
msg.From = "info@marinetrack.com"
msg.FromName = "Info"
msg.Subject = "VesselTrack Enquiry Form"
msg.AddRecipient "sales@marinetrack.com"
'msg.AddRecipient "rob@re-media.biz"
msg.Body = "The following submission was made at " & dateTime & " GMT" & vbCrLf & vbCrLf & _
"Contact Name: " & frmContactName & vbCrLf & _
"Company: " & frmCompany & vbCrLf & _
"Email Address: " & frmEmailAdd & vbCrLf & _
"Telephone: " & frmTelephone
If Not (msg.Send("192.168.221.1")) Then
Response.Write(msg.ErrorMessage)
Response.Flush()
CreateMessage = False
Else
CreateMessage = True
End If
End Function
' ----------------------------------------------------------------------
' ----------------------------------------------------------------------
' GotIllegalData(value)
' ----------------------------------------------------------------------
Function GotIllegalData()
Dim foundData
foundData = False
Dim illegalData
illegalData = Array("BCC:", "CC:", "CONTENT-TYPE", "%0A")
Dim i, j
For i = 1 To Request.Form.Count
For j = 0 To UBound(illegalData)
If (InStr(1, UCase(Request.Form.Item(i)), illegalData(j), 0)) Then
foundData = True
End If
Next
Next
GotIllegalData = foundData
End Function
' ----------------------------------------------------------------------
%>
MarineTrack | Ship Security Alert Systems | Long Range Identification & Tracking | Vessel Track