<% 'no security checking %>
<%
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.CacheControl = "no-cache"
%>
<%
response.buffer = true
'get action
a=request.form("a")
'get fields from form
x_ContactID = Request.Form("x_ContactID")
x_CompanyName = Request.Form("x_CompanyName")
x_Genre = Request.Form("x_Genre")
x_FirstName = Request.Form("x_FirstName")
x_LastName = Request.Form("x_LastName")
x_Address = Request.Form("x_Address")
x_City = Request.Form("x_City")
x_StateOrProvince = Request.Form("x_StateOrProvince")
x_PostalCode = Request.Form("x_PostalCode")
x_Country2FRegion = Request.Form("x_Country2FRegion")
x_WorkPhone = Request.Form("x_WorkPhone")
x_WorkExtension = Request.Form("x_WorkExtension")
x_FaxNumber = Request.Form("x_FaxNumber")
x_EmailAddress = Request.Form("x_EmailAddress")
x_WebSite = Request.Form("x_WebSite")
x_RegisterDate = Request.Form("x_RegisterDate")
x_ModifiedDate = Request.Form("x_ModifiedDate")
x_Field1 = Request.Form("x_Field1")
x_Notes = Request.Form("x_Notes")
x_Password = Request.Form("x_Password")
x_RePassword = Request.Form("x_RePassword")
x_NewsLetter1 = Request.Form("x_NewsLetter1")
%>
<%
' Open Connection to the database
set conn = Server.CreateObject("ADODB.Connection")
conn.Open xDb_Conn_Str
Select Case a
Case "A": ' Add
' Open record
strsql = "SELECT * FROM [Contacts] WHERE 0 = 1"
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 2
rs.AddNew
tmpFld = Trim(x_CompanyName)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("CompanyName") = tmpFld
tmpFld = Trim(x_Genre)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("Genre") = tmpFld
tmpFld = Trim(x_FirstName)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("FirstName") = tmpFld
tmpFld = Trim(x_LastName)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("LastName") = tmpFld
tmpFld = Trim(x_Address)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("Address") = tmpFld
tmpFld = Trim(x_City)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("City") = tmpFld
tmpFld = Trim(x_StateOrProvince)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("StateOrProvince") = tmpFld
tmpFld = Trim(x_PostalCode)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("PostalCode") = tmpFld
tmpFld = Trim(x_Country2FRegion)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("Country/Region") = tmpFld
tmpFld = Trim(x_WorkPhone)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("WorkPhone") = tmpFld
tmpFld = Trim(x_WorkExtension)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("WorkExtension") = tmpFld
tmpFld = Trim(x_FaxNumber)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("FaxNumber") = tmpFld
tmpFld = Trim(x_EmailAddress)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("EmailAddress") = tmpFld
tmpFld = Trim(x_WebSite)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("WebSite") = tmpFld
tmpFld = x_RegisterDate
If IsDate(tmpFld) Then
rs("RegisterDate") = cDate(tmpFld)
Else
rs("RegisterDate") = Null
End If
tmpFld = x_ModifiedDate
If IsDate(tmpFld) Then
rs("ModifiedDate") = cDate(tmpFld)
Else
rs("ModifiedDate") = Null
End If
tmpFld = Trim(x_Field1)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("Field1") = tmpFld
tmpFld = Trim(x_Notes)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("Notes") = tmpFld
tmpFld = Trim(x_Password)
If trim(tmpFld) & "x" = "x" Then tmpFld = Null
rs("Password") = tmpFld
tmpFld = x_NewsLetter1
If tmpFld = "Yes" Then
rs("NewsLetter1") = True
Else
rs("NewsLetter1") = False
End If
rs.Update
rs.Close
Set rs = Nothing
'sqlwrk = "SELECT [Admin Email] FROM [Admin Email] ORDER BY [AdminEmailID]"
sqlwrk = "SELECT [AdminEmail] FROM [Admin Email]"
Set rswrk = Server.CreateObject("ADODB.Recordset")
'rswrk.Open sqlwrk, conn, 1, 2
rswrk.Open sqlwrk, conn
If Not rswrk.EOF Then
datawrk = rswrk.GetRows
rowswrk = UBound(datawrk, 2)
For rowcntwrk = 0 To rowswrk
if nfymail1 then
strFrom= emailfrmadd
strTo=datawrk(0, rowcntwrk)
strSubj= NotifySubj1
strBody= notifyBody1 &VBCrlf &webpath &"/admin/Contactslist.asp?psearch=" &x_EmailAddress
StrHtml=1
call mailout(strFrom,strTo,strSubj,strBody,strHtml)
end if
next
end if
if grtmail1 then
strFrom= emailfrmadd
strTo= x_EmailAddress
strSubj= GreetSubj1
strBody= GreetBody1
StrHtml=1
call mailout(strFrom,strTo,strSubj,strBody,strHtml)
end if
rswrk.close
conn.Close
Set conn = Nothing
Response.Clear
Response.Redirect "success.html"
End Select
%>