<% 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 mailinglist WHERE indexid = " & indexid Set rs = conn.execute(sql) If rs.eof then bError = true Else bError = false firstname = rs("firstname") lastname = rs("lastname") email = rs("email") daysonlist = rs("daysonlist") sitecode = rs("sitecode") source = rs("source") state = rs("state") country = rs("country") '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) 'delete from list sql = "DELETE from mailinglist WHERE indexid = " & 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 Diabetes Updates 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 %>