%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim cn : Set cn = Server.CreateObject("ADODB.Connection")
'-------------------------------
' Create database connection string, login and password variables
'-------------------------------
Dim strConn, strLogin, strPassword
strConn = "Driver={MySQL};DATABASE=fairla2_xmb3;UID=fairla2_issue;PASSWORD=coconuts"
'-------------------------------
' Open the connection
'-------------------------------
%>
Fair Lakes Condominium
<%
success = 0
If "Insert"=Request("ActionType") Then
Set cn = Server.CreateObject("ADODB.Connection")
cn.open strConn
'sqlEmail = "Select * from PET_REGISTRATION where EMAIL_ADDRESS = '"&Request.Form("email")&"'"
'set RSEmail = Server.CreateObject("ADODB.Recordset")
'RSEmail.open sqlEmail, cn
If Request.Form("owner1") = "" Then
Response.Write("
Please enter the name of Unit Owner #1. ")
l_error = 1
End If
If Request.Form("email") = "" Then
Response.Write("
Please enter a valid email address. ")
l_error = 1
End If
If Left(Request.Form("address_number"), 2) <> "12" Then
Response.Write("
The address number is not valid. ")
l_error = 1
End If
If NOT IsNumeric(Request.Form("address_number")) Then
Response.Write("
The address number is not valid. ")
l_error = 1
End If
If NOT IsNumeric(Request.Form("unit_number")) AND NOT Request.Form("unit_number") = "" Then
Response.Write("
The unit number is not valid. ")
l_error = 1
End If
If InStr(1, Request.Form("email"), "@", vbTextCompare) = 0 Then
response.write ("
The e-mail address you entered is invalid. Please enter a valid one. ")
l_error = 1
End If
If NOT IsNumeric(Request.Form("pets")) OR Request.Form("pets") = "" Then
Response.Write("
Please fill in the number of pets you have to register. ")
l_error = 1
End If
If NOT IsNumeric(Request.Form("dogs")) OR Request.Form("dogs") = "" Then
Response.Write("
Please fill in the number of dogs you have to register. ")
l_error = 1
End If
IF Request.Form("dogs") > Request.Form("pets") Then
Response.Write("
The number of dogs may not exceed the number of total pets. ")
l_error = 1
End If
If Request.Form("agree") <> "agreed" Then
Response.Write("
You must click the checkbox indicating you agree to the terms of the Pet Resolution. ")
l_error = 1
End If
IF l_error <> 1 Then
pet_desc = Left(Request.Form("description"), 255)
sql = "Insert Into PET_REGISTRATION (ADDRESS_NUMBER, UNIT_NUMBER, OWNER_1_NAME, OWNER_2_NAME, SUBMITTED_DATE, NUMBER_OF_PETS, NUMBER_OF_DOGS, IP_ADDRESS, EMAIL_ADDRESS, DESCRIPTION) "&_
"Values ( '"&Request.Form("address_number")&"', '"&Request.Form("unit_number")&"', '"&Request.Form("owner1")&"', '"&Request.Form("owner2")&"', DATE_ADD(SYSDATE(), INTERVAL 3 HOUR), '"&Request.Form("pets")&"','" & Request.Form("dogs")&"','" & Request.ServerVariables("REMOTE_ADDR") & "','"&Request.Form("email")&"', '" & pet_desc &"')"
'Response.Write(sql&" ")
response.write ("Thank you for registering your pet. A confirmation email will be sent to you shortly.Return to the Fair Lakes Condominium Home Page ")
cn.Execute sql
'Send the confirmation email
mailBody = "Your pet registration has been received."
Set newMsg = CreateObject("CDONTS.NewMail")
newMsg.BodyFormat=0
newMsg.From="Fair Lakes Condo Association "
newMsg.To=Request.Form("email")
newMsg.Subject = "Pet Registration Received"
newMsg.Body = mailBody
newMsg.Send
'Send a copy to management
mailBody2 = "" & Request.Form("address_number") & " " & Request.Form("unit_number") & " has submitted an online pet registration form."& " IP:" & Request.ServerVariables("REMOTE_ADDR")
mailBody2 = mailBody2 & " E-Mail: " & Request.Form("email")
mailBody2 = mailBody2 & " Unit Owner #1: " & Request.Form("owner1")
mailBody2 = mailBody2 & " Unit Owner #2: " & Request.Form("owner2")
mailBody2 = mailBody2 & " Number of Pets: " & Request.Form("pets")
mailBody2 = mailBody2 & " Number of Dogs: " & Request.Form("dogs")
mailBody2 = mailBody2 & " Description: " & pet_desc
mailBody2 = mailBody2 & " Annual Charge: $" & Request.Form("dogs") * 30
mailBody2 = mailBody2 & " Management: Please add this fee to the Unit Owners' account as a recurring yearly assessment."
Set newMsg2 = CreateObject("CDONTS.NewMail")
newMsg2.BodyFormat=0
newMsg2.From="Fair Lakes Condo Association "
IF Request.Form("dogs") > 0 THEN
newMsg2.To="management@fairlakescondo.com"
ELSE
newMsg2.To="robb.moskowitz@fairlakescondo.com"
END IF
newMsg2.Subject = Request.Form("address_number") & " " & Request.Form("unit_number") & " Pet Registration "
newMsg2.Body = mailBody2
newMsg2.Send
success = 1
End If
'RSEmail.close
cn.close
End If
'Else
If success = 0 Then
%>
Pet Registration Form
I/We certify that my/our pet(s) have received all inoculations as required
by law. I/We have received a copy of the Pet Resolution on keeping pets on
the Property. I/We have read and understand and will comply with the requirements
of the Pet Resolution and the information
listed above is true and correct. We recognize and accept responsibility and
liability for all damages that may result from the presence of our pet in
the condominium; whether that be damage to a person, the common elements,
a unit, or another pet.
<%
End If
%>