></table>
<%
page = Request( "pg" )
IF page = "" THEN page = 1
readydbCon
SET RS = Server.CreateObject( "ADODB.Recordset" )
RS.ActiveConnection = Con
RS.CursorType = adOpenStatic
RS.Open "select m_id, m_email, m_subject, m_numreplies, m_entrydate FROM messages WHERE m_reply=-1 ORDER
by m_id DESC"
RS.PageSize = messagesApage
RS.AbsolutePage = page
IF RS.EOF THEN
%>
<font face="Arial">There are no messages</font>
<%
ELSE
%>
<table width="100%" border=0 cellpadding=4 cellspacing=0>
<tr>
<td>
<font size="2" color="darkgreen"><b>AUTHOR</b></font>
</td>
<td>
<font size="2" color="darkgreen"><b>SUBJECT</b></font>
</td>
<td>
<font size="2" color="darkgreen"><b>REPLIES</b></font>
</td>
<td>
<font size="2" color="darkgreen"><b>DATE POSTED</b></font>
</td>
</tr>
<%
WHILE NOT RS.EOF and counter < RS.PageSize
%>
<tr>
<td><font size="2" ><%=showUser( RS( "m_email" ) )%></font></td>
<td><a href="message.asp?id=<%=RS( "m_id" )%>&pg=<%=page%>" target="message"><font
size="2"><%=Server.HTMLEncode( RS( "m_subject" ) )%></font></a></td>
<td>
<font size="2"><%=RS( "m_numreplies" )%> </font>
<% IF cINT( RS( "m_numreplies" ) ) > 0 THEN %>
<a href="message.asp?id=<%=RS( "m_id" )%>&pg=<%=page%>#replies"
target="message"><font size="2">view</font></a>
<% END IF %>
</td>
<td><font size="2"><%=RS( "m_entrydate" )%></font></td>
</tr>
<%
counter = counter+1
RS.MoveNext
WEND
%>
</table>
<%
IF RS.PageCount > 1 THEN
%>
<p><font size="2" color="#666666">View Page: </font>
<%
FOR i = 1 to RS.PageCount
IF i = cINT( page ) THEN
%>
<font size="2"><b><%=i%></b></font>
<%
ELSE
%>
<a href="discussframes.asp?pg=<%=i%>" target="topframe"><font size="2"><%=i%></font></a>
<%
END IF
NEXT
END IF
END IF
RS.Close
Con.Close
%>
</body>
</html>
----------------------------------------------
Listing 7.0 - post.asp
-------------------------------
<%
page = TRIM( Request( "pg" ) )
id = TRIM( Request( "id" ) )
email = TRIM( Request( "email" ) )
subject = TRIM( Request( "subject" ) )
message = TRIM( Request( "message" ) )
%>
<HTML>
<HEAD>
<TITLE>Post</TITLE>
</HEAD>
<BODY bgcolor="#000000">
<form method="post" action="discussframes.asp" target="topframe">
<input name="pg" type="hidden" value="<%=page%>">
<% IF id = "" THEN %>
<input name="addm" type="hidden" value="-1">
<% ELSE %>
<input name="addm" type="hidden" value="<%=id%>">
<% END IF %>
<center>
<table width="640" cellpadding="4" cellspacing=0 border=0>
<tr>
<td align="right" nowrap>
<font face="Arial" size="2" color="yellow"><b>Your Email Address:</b></font>
</td>
<td>
<input name="email" size="60" maxlength="255" value="<%=Server.HTMLEncode( email )%>">
</td>
</tr>
<tr>
<td align="right">
<font face="Arial" size="2" color="yellow"><b>Message Subject:</b></font>
</td>
<td>
<input name="subject" size="60" maxlength="50" value="<%=Server.HTMLEncode( subject )%>">
</td>
</tr>
<tr>
<td align="right" valign="top">
<font face="Arial" size="2" color="yellow"><b>Message:</b></font>
</td>
<td>
<textarea name="message" cols="60" rows="13" wrap="virtual"><%=Server.HTMLEncode( message )%
></textarea>
</td>
</tr>
<tr>
<td align="right" colspan=2>
<table border=0 cellpadding=2 cellspacing=0>
<tr>
<td>
<input type="submit" value="Post Message" style="color:blue;font-family:Arial;font-
weight:bold">
</td>
</form>
<form action="discussframes.asp" target="topframe">
<td>
<input type="submit" value="Cancel Message" style="color:blue;font-family:Arial;font-
weight:bold">
</td>
</tr>
</table>
</td>
</tr>
</table>
</BODY>
</HTML>
<%
page = Request( "pg" )
IF page = "" THEN page = 1
readydbCon
SET RS = Server.CreateObject( "ADODB.Recordset" )
RS.ActiveConnection = Con
RS.CursorType = adOpenStatic
RS.Open "select m_id, m_email, m_subject, m_numreplies, m_entrydate FROM messages WHERE m_reply=-1 ORDER
by m_id DESC"
RS.PageSize = messagesApage
RS.AbsolutePage = page
IF RS.EOF THEN
%>
<font face="Arial">There are no messages</font>
<%
ELSE
%>
<table width="100%" border=0 cellpadding=4 cellspacing=0>
<tr>
<td>
<font size="2" color="darkgreen"><b>AUTHOR</b></font>
</td>
<td>
<font size="2" color="darkgreen"><b>SUBJECT</b></font>
</td>
<td>
<font size="2" color="darkgreen"><b>REPLIES</b></font>
</td>
<td>
<font size="2" color="darkgreen"><b>DATE POSTED</b></font>
</td>
</tr>
<%
WHILE NOT RS.EOF and counter < RS.PageSize
%>
<tr>
<td><font size="2" ><%=showUser( RS( "m_email" ) )%></font></td>
<td><a href="message.asp?id=<%=RS( "m_id" )%>&pg=<%=page%>" target="message"><font
size="2"><%=Server.HTMLEncode( RS( "m_subject" ) )%></font></a></td>
<td>
<font size="2"><%=RS( "m_numreplies" )%> </font>
<% IF cINT( RS( "m_numreplies" ) ) > 0 THEN %>
<a href="message.asp?id=<%=RS( "m_id" )%>&pg=<%=page%>#replies"
target="message"><font size="2">view</font></a>
<% END IF %>
</td>
<td><font size="2"><%=RS( "m_entrydate" )%></font></td>
</tr>
<%
counter = counter+1
RS.MoveNext
WEND
%>
</table>
<%
IF RS.PageCount > 1 THEN
%>
<p><font size="2" color="#666666">View Page: </font>
<%
FOR i = 1 to RS.PageCount
IF i = cINT( page ) THEN
%>
<font size="2"><b><%=i%></b></font>
<%
ELSE
%>
<a href="discussframes.asp?pg=<%=i%>" target="topframe"><font size="2"><%=i%></font></a>
<%
END IF
NEXT
END IF
END IF
RS.Close
Con.Close
%>
</body>
</html>
----------------------------------------------
Listing 7.0 - post.asp
-------------------------------
<%
page = TRIM( Request( "pg" ) )
id = TRIM( Request( "id" ) )
email = TRIM( Request( "email" ) )
subject = TRIM( Request( "subject" ) )
message = TRIM( Request( "message" ) )
%>
<HTML>
<HEAD>
<TITLE>Post</TITLE>
</HEAD>
<BODY bgcolor="#000000">
<form method="post" action="discussframes.asp" target="topframe">
<input name="pg" type="hidden" value="<%=page%>">
<% IF id = "" THEN %>
<input name="addm" type="hidden" value="-1">
<% ELSE %>
<input name="addm" type="hidden" value="<%=id%>">
<% END IF %>
<center>
<table width="640" cellpadding="4" cellspacing=0 border=0>
<tr>
<td align="right" nowrap>
<font face="Arial" size="2" color="yellow"><b>Your Email Address:</b></font>
</td>
<td>
<input name="email" size="60" maxlength="255" value="<%=Server.HTMLEncode( email )%>">
</td>
</tr>
<tr>
<td align="right">
<font face="Arial" size="2" color="yellow"><b>Message Subject:</b></font>
</td>
<td>
<input name="subject" size="60" maxlength="50" value="<%=Server.HTMLEncode( subject )%>">
</td>
</tr>
<tr>
<td align="right" valign="top">
<font face="Arial" size="2" color="yellow"><b>Message:</b></font>
</td>
<td>
<textarea name="message" cols="60" rows="13" wrap="virtual"><%=Server.HTMLEncode( message )%
></textarea>
</td>
</tr>
<tr>
<td align="right" colspan=2>
<table border=0 cellpadding=2 cellspacing=0>
<tr>
<td>
<input type="submit" value="Post Message" style="color:blue;font-family:Arial;font-
weight:bold">
</td>
</form>
<form action="discussframes.asp" target="topframe">
<td>
<input type="submit" value="Cancel Message" style="color:blue;font-family:Arial;font-
weight:bold">
</td>
</tr>
</table>
</td>
</tr>
</table>
</BODY>
</HTML>