<% indexid = Request.Querystring("id") If indexid = "" OR isNumeric(indexid) = false Then call errormsg Response.end Else Set conn = Server.CreateObject("ADODB.Connection") conn.open Application("connstring") sql = "SELECT * From customers WHERE idcustomer = " & indexid Set rs = conn.execute(sql) If rs.eof then bError = true Else bError = false firstname = rs("name") lastname = rs("lastname") email = rs("email") If rs("daysonlist") > 0 Then daysonlist = rs("daysonlist") Else daysonlist = 0 End If sitecode = "cust" source = "customer" state = rs("statecode") country = rs("countrycode") 'record the unsubscribe sql = "INSERT into unsubscribes (state, country, sitecode, source, firstname, lastname, email, daysonlist, indexid) VALUES ('" & _ state & "','" & sqlprep(country) & "','" & sitecode & "','" & source & "','" & sqlprep(firstname) & "','" & sqlprep(lastname) & "','" & email & "'," & daysonlist & "," & indexid & ")" conn.execute(sql) 'update customer database sql = "UPDATE Customers SET unsubscribe = 1 WHERE idcustomer = " & indexid conn.execute(sql) End If Set rs = nothing conn.close set conn = nothing If bError = true Then call errormsg Response.end End If End If %>

You have been automatically unsubscribed from our Flourish Wellness Customer mailing list. If this has been a mistake or you have changed your mind, click here to add yourself back to our list.

Click Here to return to our site.

<% Sub errormsg %>

There was an error processing your request. We could not find your record in our database.

<% End Sub Function sqlprep(str) 'tack on a space to prevent invalid use of null then trim off with trim command sqlprep = Trim(Replace(str & " ","'","''")) End Function %>