% Option Explicit %>
<%
'Declare variables
Dim rsRemoveListMember 'Database recordset variable
Dim strUserID 'Holds the users e-mail address
Dim strErrorMessage 'Holds the error message if the user is not entered into the database
'Read in the persons e-mail address
strUserID = Request.QueryString("ID")
'Clean up the input code address address getting rid of unwated characters
strUserID = characterStrip(strUserID)
'Create recorset object
Set rsRemoveListMember = Server.CreateObject("ADODB.Recordset")
'Initalise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tblMailingList.* FROM tblMailingList WHERE tblMailingList.ID_code = '" & strUserID & "';"
'Set the cursor type property of the record set to Dynamic so we can navigate through the record set
rsRemoveListMember.CursorType = 2
'Set the Lock Type for the records so that the record set is only locked when it is deleteed
rsRemoveListMember.LockType = 3
'Query the database
rsRemoveListMember.Open strSQL, adoCon
'If there is no error message then add the new user to the database
If NOT rsRemoveListMember.EOF Then
'Delete the record
rsRemoveListMember.Delete
Else
'As there is no record returned we need an error message
strErrorMessage = "
Sorry, an error has occured and you can not be removed from the list."
strErrorMessage = strErrorMessage & "
Please contact " & strWebsiteName & "'s webmaster to be removed from the mailing list."
strErrorMessage = strErrorMessage & "
" & strWebsiteEmailAddress & ""
End If
'If this is the webmasters email ID then just display a test message
If strUserID = "webmaster0001" Then strErrorMessage = "Preview email.
You can not remove preview email address from the database."
'Reset server objects
rsRemoveListMember.Close
Set rsRemoveListMember = Nothing
Set strCon = Nothing
Set adoCon = Nothing
%>