% Option Explicit %>
<%
'Set the response buffer to true as we maybe redirecting
Response.Buffer = True
'Dimension variables
Dim rsListMembers 'Database Recordset Variable
Dim intRecordPositionPageNum 'Holds the record position
Dim intRecordLoopCounter 'Loop counter for displaying the records
Dim intTotalNumEntries 'Holds the total number of records in the database
Dim intTotalNumPages 'Holds the total number of pages in the database
Dim intLinkPageNum 'Holds the page number to be linked to
'If the session variable is False or does not exsist then redirect the user to the unauthorised user page
If Session("blnIsUserGood") = False or IsNull(Session("blnIsUserGood")) = True then
'Redirect to unathorised user page
Response.Redirect"unauthorised_user_page.htm"
End If
'If this is the first time the page is displayed then the record position is set to page 1
If Request.QueryString("PagePosition") = "" Then
intRecordPositionPageNum = 1
'Else the page has been displayed before so the record postion is set to the Record Position number
Else
intRecordPositionPageNum = CLng(Request.QueryString("PagePosition"))
End If
'Create recorset object
Set rsListMembers = Server.CreateObject("ADODB.Recordset")
'Initalise the strSQL variable with an SQL statement to query the database by selecting all tables ordered by the decending date
strSQL = "SELECT tblMailingList.* FROM tblMailingList ORDER BY tblMailingList.Email ASC;"
'Set the cursor type property of the record set to dynamic so we can naviagate through the record set
rsListMembers.CursorType = 3
'Query the database
rsListMembers.Open strSQL, adoCon
'Set the number of records to display on each page by the constant set at the top of the script
rsListMembers.PageSize = 40
'Get the record poistion to display from
If NOT rsListMembers.EOF Then rsListMembers.AbsolutePage = intRecordPositionPageNum
%>
Remove Mailing List Members
<%
'Display an HTML table with links to the other entries in the
Response.Write vbCrLf & " "
Response.Write vbCrLf & " "
Response.Write vbCrLf & " "
Response.Write vbCrLf & " "
Response.Write vbCrLf & " "
Response.Write vbCrLf & " | "
'If there are more pages to display then add a title to the other pages
If intRecordPositionPageNum > 1 or NOT rsListMembers.EOF Then
Response.Write vbCrLf & " Page: "
End If
'If the page number is higher than page 1 then display a back link
If intRecordPositionPageNum > 1 Then
Response.Write vbCrLf & " << Prev "
End If
'If there are more pages to display then display links to all the pages
If intRecordPositionPageNum > 1 or NOT rsListMembers.EOF Then
'Display a link for each page in the
For intLinkPageNum = 1 to intTotalNumPages
'If the page to be linked to is the page displayed then don't make it a hyper-link
If intLinkPageNum = intRecordPositionPageNum Then
Response.Write vbCrLf & " " & intLinkPageNum
Else
Response.Write vbCrLf & " " & intLinkPageNum & " "
End If
Next
End If
'If it is Not the End of the entries then display a next link for the next page
If NOT rsListMembers.EOF then
Response.Write vbCrLf & " Next >>"
End If
'Finsh HTML the table
Response.Write vbCrLf & " | "
Response.Write vbCrLf & " "
Response.Write vbCrLf & " "
Response.Write vbCrLf & " | "
Response.Write vbCrLf & "
"
Response.Write vbCrLf & "
"
'Reset Sever Objects
Set adoCon = Nothing
Set strCon = Nothing
Set rsListMembers = Nothing
%>