%@LANGUAGE="VBSCRIPT"%>
<%
' *** Edit Operations: declare variables
MM_editAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Request.QueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables
If (CStr(Request("MM_insert")) <> "") Then
MM_editConnection = MM_connCapRes_STRING
MM_editTable = "Property_Details"
MM_editRedirectUrl = "added.asp"
MM_fieldsStr = "service_required|value|date_time|value|image_one|value|image_two|value|image_three|value|image_four|value|image_five|value|image_six|value|image_seven|value|image_eight|value|image_nine|value|image_ten|value|sale_status|value|status|value|username|value|password|value|name|value|email_address|value|daytime_phone|value|evening_phone|value|mobile_phone|value|address1|value|address2|value|address3|value|county_or_state|value|postcode_or_zip|value|country|value|property_price|value|number_of_bedrooms|value|number_of_receptions|value|number_of_bathrooms|value|number_of_garages|value|summery|value|description|value|property_type|value|property_style|value|tenure|value|years_remaining|value|property_age|value|garden|value|location|value|area|value|garaging|value|commercial|value|feature_one|value|feature_two|value|feature_three|value|feature_four|value|feature_five|value|property_name_or_number|value|property_street_name|value|property_town_or_area|value|property_county|value|property_postcode_or_zip|value|property_country|value"
MM_columnsStr = "Service_Requested|',none,''|Date_Added|',none,''|Image1|',none,''|Image2|',none,''|Image3|',none,''|Image4|',none,''|Image5|',none,''|Image6|',none,''|Image7|',none,''|Image8|',none,''|Image9|',none,''|Image10|',none,''|Sale_Status|',none,''|Status|',none,''|xUserName|',none,''|Password|',none,''|Name|',none,''|Email_Address|',none,''|Daytime_Phone|',none,''|Evening_Phone|',none,''|Mobile_Phone|',none,''|Address1|',none,''|Address2|',none,''|Address3|',none,''|County_or_State|',none,''|Postcode_or_Zip|',none,''|Country|',none,''|Property_Price|',none,''|Number_of_Bedrooms|',none,''|Number_of_Receptions|',none,''|Number_of_Bathrooms|',none,''|Number_of_Garages|',none,''|Summery|',none,''|Description|',none,''|Property_Type|',none,''|Property_Style|',none,''|Tenure|',none,''|Years_Remaining|',none,''|Property_Age|',none,''|Garden|',none,''|Location|',none,''|Area|',none,''|Garaging|',none,''|Commercial|',none,''|Main_Feature1|',none,''|Main_Feature2|',none,''|Main_Feature3|',none,''|Main_Feature4|',none,''|Main_Feature5|',none,''|Property_Name_or_Number|',none,''|Property_Street_Name|',none,''|Property_Town_or_Area|',none,''|Property_County|',none,''|Property_Postcode_or_Zip|',none,''|Property_Country|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(Request.Form(MM_fields(i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it
If (CStr(Request("MM_insert")) <> "") Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),",")
Delim = MM_typeArray(0)
If (Delim = "none") Then Delim = ""
AltVal = MM_typeArray(1)
If (AltVal = "none") Then AltVal = ""
EmptyVal = MM_typeArray(2)
If (EmptyVal = "none") Then EmptyVal = ""
If (FormVal = "") Then
FormVal = EmptyVal
Else
If (AltVal <> "") Then
FormVal = AltVal
ElseIf (Delim = "'") Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''") & "'"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "127.0.0.1" ' SMTP Server Name
Mail.FromName = "Capital Residence.com" ' Sender's Name
Mail.From = "sales@capital-residence.com" ' Sender's Email
Mail.AddAddress request.form("email_address") ' YOUR Email address
Mail.Subject = "Welcome to Capital Residence"
Mail.Body = "Welcome" & _
vbNewLine _
& "Your property is now on the Capital Residence database." & _
vbNewLine _
& _
vbNewLine _
& _
vbNewLine _
& "After you have completed payment your property will go live. To edit your details or to upload images click on edit your details at the top of any page and log in using the username and password below." & _
vbNewLine _
& "Username : " & request.form("username") & _
vbNewLine _
& "Password : " & request.form("password") & _
vbNewLine _
& _
vbNewLine _
& _
vbNewLine _
& "http://www.capital-residence.com"
Mail.ContentTransferEncoding = "Quoted-Printable"
On Error Resume Next
Mail.Send
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
National Residence | Commission Free Property Sales| Sell my home with National Residence
<%
Dim MM_paramName
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "") Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>