% Dim sDBExtraPath Dim sSuccess Dim sError Dim sSubscriberID Dim sCategoryID Dim sMail, oMail, sCategories, rsCategories Dim sCurrentPage, sPCMID sCurrentPage="contactus" sCurrentPage2 = "Contact Us" sPCMID = "PCM_CONTACTUS" %> <% Select Case Request("cmd") Case "Subscribe" sSQL = "SELECT * FROM mmSubscribers WHERE Email = '" + Request("email") + "'" rsData.Open sSQL, conDB, adOpenKeyset, adLockOptimistic, adCmdText If IsRSEmpty(rsData) Then rsData.AddNew rsData("Email") = Request("email") End If rsData("FirstName") = ToDB(Request("fname")) rsData("LastName") = ToDB(Request("lname")) rsData("Company") = ToDB(Request("company")) rsData("Address1") = ToDB(Request("address1")) rsData("Address2") = ToDB(Request("address2")) rsData("City") = ToDB(Request("city")) rsData("State") = ToDB(Request("State")) rsData("PostalCode") = ToDB(Request("PostalCode")) rsData("Country") = ToDB(Request("Country")) rsData("Phone") = ToDB(Request("Phone")) rsData("Fax") = ToDB(Request("Fax")) rsData("Notes") = ToDB(Request("Notes")) On Error Resume Next rsData.Update If Err.Number = 0 Then sSubscriberID = rsData("SubscriberID") rsData.Close If Len(Request("category"))>0 Then For Each sCategoryID In Request("category") sSQL = "INSERT INTO mmSubscriptions VALUES (" & sSubscriberID & ", " & sCategoryID & ")" conDB.Execute sSQL Next End If sSuccess = smSuccessAdded Else sError = smNoAdded End If If Len(Request("category"))>0 Then sSQL = "SELECT Name FROM mmCategories WHERE CategoryID IN (" & Request("category") & ")" Set rsCategories = conDB.Execute(sSQL) sCategories = "
" & smHeaderMail & "
" _ & "" & Request("fname") & " " & Request("lname") & "
" _
& Request("company") & "
" _
& Request("address1") & "
" _
& Request("address2") & "
" _
& Request("city") & ", " & Request("state") & "
" _
& Request("postalcode") & "
" _
& Request("country") & "
" _
& "" & smPhone & ": " & Request("phone") & "
" _
& "" & smFax & ": " & Request("fax") _
& "
" & smCategories & ":
" _ & sCategories & "" _ & Request("Notes") _ & "
" Set oMail = Server.CreateObject("CDONTS.NewMail") With oMail .BodyFormat = 0 .MailFormat = 0 .Subject = smSubjectSubscribe .From = Request("email") .To = gsContactUsEMail .Body = sMail .Send End With Set oMail = Nothing On Error Goto 0 Case "Unsubscribe" sSQL = "SELECT COUNT(*) FROM mmSubscribers WHERE Email = '" + Request("email") + "'" Set rsData = conDB.Execute(sSQL) If rsData(0) = 0 Then sError = smEmailNotFound Else sSQL = "DELETE FROM mmSubscribers WHERE Email = '" + Request("email") + "'" conDB.Execute sSQL sSuccess = smProfileRemoved sMail = "" _ & "" _ & "" _ & "" & smUnsubscribeFromList & "
" _ & "" Set oMail = Server.CreateObject("CDONTS.NewMail") With oMail .BodyFormat = 0 .MailFormat = 0 .Subject = smSubjectUnsubscribe .From = gsContactUsEMail .To = Request("email") .Body = sMail .Send End With Set oMail = Nothing End If End Select Response.Write sPageContent If Len(sSuccess) > 0 Then%><%=sSuccess%>
<%ElseIf Len(sError) > 0 Then%><%=sError%>
<%End If%>