<% response.redirect "index.html" If Request.ServerVariables("HTTP_X_FORWARDED_FOR") <> "" Then FromIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR") ElseIf Request.ServerVariables("HTTP_CLIENT_IP") <> "" Then FromIP = Request.ServerVariables("HTTP_CLIENT_IP") ElseIf Request.ServerVariables("REMOTE_ADDR") <> "" Then FromIP = Request.ServerVariables("REMOTE_ADDR") end if Errore = false Public Function IsValid(email) IsValid = true dim names, name, i, c names = Split(email, "@") if UBound(names) <> 1 then IsValid = false exit function end if for each name in names if Len(name) <= 0 then IsValid = false exit function end if for i = 1 to Len(name) c = Lcase(Mid(name, i, 1)) letters="abcdefghijklmnopqrstuvwxyz_-." if InStr(letters, c) <= 0 and not IsNumeric(c) then IsValid = false exit function end if next if Left(name, 1) = "." or Right(name, 1) = "." then IsValid = false exit function end if next if InStr(names(1), ".") <= 0 then IsValid = false exit function end if i = Len(names(1)) - InStrRev(names(1), ".") if i <> 2 and i <> 3 then IsValid = false exit function end if if InStr(email, "..") > 0 then IsValid = false end if End Function DIM Jmail, email, frombase, tobase, startdate, finishdate, firstname, lastname, tel_customer email = Trim(request.form("email_address")) frombase = request.form("frombase") tobase = request.form("tobase") startdate = Trim(request.form("startdate")) finishdate = Trim(request.form("finishdate")) firstname = Trim(request.form("firstname")) lastname = Trim(request.form("lastname")) tel_customer = Trim(request.form("tel_customer")) if request.form("go") = 1 then if IsValid(email) = False Then errore = True err_email = True email = "" end if if IsDate(startdate) = False then errore = True err_startdate = True startdate = "" end if if IsDate(finishdate) = False then errore = True err_finishdate = True finishdate = "" end if if firstname = "--First Name--" Then errore = True err_name = True elseif Len(firstname)<2 Then errore = True err_name = True end if if lastname = "--Last Name--" Then errore = True err_name = True elseif Len(lastname)<2 Then errore = True err_name = True end if if errore <> True then Set Jmail = Server.CreateObject("Jmail.Message") Recipient = "info@k6yachting.com" Sender = email Subject = "Check Availibility for Bella Vita" msg = "Base from: " & frombase & vbcrlf msg = msg & "Base to: " & tobase & vbcrlf msg = msg & "Start date: " & startdate & vbcrlf msg = msg & "End date: " & finishdate & vbcrlf msg = msg & "First name: " & firstname & vbcrlf msg = msg & "Last name: " & lastname & vbcrlf msg = msg & "Telephone number: " & tel_customer & vbcrlf & vbcrlf msg = msg & "IP: " & FromIP 'Jmail.logging = true Jmail.AddRecipient Recipient Jmail.From = Sender Jmail.FromName = name Jmail.Subject = Subject Jmail.Body = msg on error resume next Jmail.send("mail.k6yachting.com") 'response.write Jmail.Log inviato = true startdate = "" finishdate = "" email = "" frombase = "" tobase = "" end if end if %>
<%if inviato = True Then%> <%end if%>
From:*
To:*
Start Date:* <%if err_startdate = True Then%> Please fill the required field. <%end if%>
Finish Date:* <%if err_finishdate = True Then%> Please fill the required field. <%end if%>
Name:*    <%if err_name = True Then%> Please fill the required field. <%end if%>
Email Address:* <%if err_email = True Then%> Please fill the required field. <%end if%>
Tel No.: