ASP留言本几个BUG

zhhzhu_it 2008-04-07 04:29:09
小生,今天下了个随缘网络留言本 V1.0(免费版),测试当中发现几个问题,请高手帮忙解决
源代码如下:
<!--#include file="conn.asp"-->
<!--#include file="ubb/ubb.asp"-->
<%Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from pz where id=1"
rs.open sql,conn,1,1
htsh=rs("sh")
%>
<SCRIPT>
function view1(url){
var url; window.open(url,'_blank','status=no,scrollbars=yes,top=20,left=110,width=600,height=460');
}
</SCRIPT>
<%
'#################################################################
'# 程序名称:随缘网络留言本 V1.0
'# 授权方式:免费软件
'# 作者:随缘网络 QQ:84723090
'# 演示及技术支持:http://www.115cn.cn/book
'# 发布时间:2007-8-8
'# 声明:本程序由随缘网络独立自主开发,保留所有版权。
'# 各种用途均可免费使用、自由传播,但必须保留程序代码中的版权信息。
'#################################################################
%>
<% Set rs2=Server.CreateObject("ADODB.RecordSet")
sql2="select top 1 * from book where sh=1 and gg=1"
rs2.Open sql2,conn,1,1
%>
<html>
<head>
<meta name="keywords" content="随缘网络,免费留言本,审核功能.留言板">
<meta name="description" content="随缘网络带审核置顶功能留言簿V1.0,打造完美免费的留言本,将免费留言板坚持到底!">
<LINK href="css.css" type=text/css rel=stylesheet>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>随缘网络带审核置顶功能留言簿V1.0--首页</title>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
</head>
<body topmargin="0" style="background-image: url('bgmain.gif'); background-position-x: center; text-align:right" >
<%
key=request("key")
fl=request("fl")
%>
<div align="center">
<table width="760" border="1" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" height="163" style="border-collapse: collapse" bordercolor="#99CCFF">
<tr>

<td width="760" height="163" align="center">
<img border="0" src="logo.jpg" width="758" height="159"></td>
</tr>
</table>

</div>

<div align="center">
<table width="760" border="0" cellpadding="0" bgcolor="#FFFFFF" height="61" style="border-collapse: collapse" bordercolor="#3399FF" id="table9">

<tr>

<td width="764" height="32" align="center" bgcolor="#99CCFF" colspan="2">
<b>
<a href="add.asp"><font color="#000000">签写留言</font></a>       
<a href="index.asp"><font color="#000000">浏览留言</font></a></b></td>
</tr>

<tr>

<td width="43" height="29" align="center">
<p align="left"><font color="#FF0000"><b>公告:</b></font></td>

<td width="717" height="29" align="center">
<marquee onMouseOver="this.stop();" onMouseOut="this.start();" scrollamount="7" scrolldelay="180"><%if rs2.eof and rs2.bof then%>暂无公告
<%else%><a href="javascript:view1('gg.asp?id=<%=rs2("id")%>')"><%=rs2("bt")%></a><%end if%></marquee></td>
</tr>

</table>
<%
page=clng(request("page"))
Set rs=Server.CreateObject("ADODB.RecordSet")
if htsh=0 then
if key="" and fl="" then
sql="select * from book where sh=1 order by gg desc, top desc,sj desc"
else
if fl=1 then
sql="select * from book where bt Like '%"& key &"%'and sh=1 order by gg desc, top desc,sj desc"
else
sql="select * from book where nr Like '%"& key &"%'and sh=1 order by gg desc, top desc,sj desc"
end if
end if
else
if key="" and fl="" then
sql="select * from book order by gg desc, top desc,sj desc"
else
if fl=1 then
sql="select * from book where bt Like '%"& key &"%'order by gg desc, top desc,sj desc"
else
sql="select * from book where nr Like '%"& key &"%' order by gg desc, top desc,sj desc"
end if
end if
end if

rs.Open sql,conn,1,1
i=1
if rs.eof and rs.bof then
response.Write("没有留言")
else
rs.PageSize=5
if page=0 then page=1
pages=rs.pagecount
if page > pages then page=pages
rs.AbsolutePage=page
for j=1 to rs.PageSize
%>
<table width="760" style="border-collapse:collapse" border="1" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF" height="166" style="border-collapse: collapse" bordercolor="#99CCFF" id="table5">
<tr>

<td height="27" align="center" bgcolor="#99CCFF">
<font color="#000000">
<a href="mailto:<%=rs("email")%>">
<img border="0" src="mail.gif" width="16" height="16"></a>  
<a target="_blank" href="http://wpa.qq.com/msgrd?V=1&Uin=<%=rs("qq")%>&Site=厦门随缘网络科技留言本&Menu=yes">
<img border="0" src="qq.gif" width="16" height="16"></a>  
<a target="_blank" href="<%=rs("web")%>">
<img border="0" src="home.gif" width="16" height="16"></a></font></td>

<td height="27" align="center" bgcolor="#99CCFF">
<p align="left"> <% if rs("top")=1 then %><b><font color="#FF0000">置顶</font></b>  <%end if%><% if rs("gg")=1 then %><b><font color="#FF0000">公告:</font></b><%else%><b>主题:</b><%end if%><%=rs("bt")%>   
发表于:<%=rs("sj")%></td>
</tr>

<tr>

<td width="25%" height="140" align="center" valign="top" rowspan="2" bordercolor="#99CCFF">
<table border="0" width="92%" cellspacing="0" cellpadding="0" id="table6">
<tr>
<td height="110">
<p align="center"><img src="<%=rs("tx")%>" ></td>
</tr>
<tr>
<td height="24" align="center"><%=rs("user")%></td>
</tr>
</table></td>
<td width="570" align="center" valign="top">
<table style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word" border="0" width="561" cellspacing="0" cellpadding="0" id="table7" height="67">
<tr>
<td width="1%">
<p align="left" style="line-height: 150%"></td>
<td width="556">
<%=Ubbcode(server.htmlencode(rs("nr")))%>
</td>
</tr>
</table>
</a></td>
</tr>
<tr>

<td width="570" align="center" height="25">
<p align="left"><%if rs("hf")="" then%><span style="font-size: 9pt"><b> <font color="#006699">管理员回复:</font></b><font color="#006699">暂未回复!</font><%else%><b> 
<font color="#006699">管理员回复:</font></b><font color="#006699"><%=rs("hf")%></font><%end if%></span></td>
</tr>
</table>
<TABLE cellSpacing=0 cellPadding=0 width=760 border=0 id="table13" bgcolor="#FFFFFF">
<TBODY>
<TR>
<TD height=6></TD></TR></TBODY></TABLE><%
i=i+1
rs.movenext
if rs.eof then exit for
next
%>
<table width="760" cellpadding="0" border="0" cellspacing="0" height="35" bgcolor="#99CCFF">
<tr bgcolor="#FFFFFF">
<td align="left" width="63%" bgcolor="#99CCFF">  <%if Page<2 then
response.write "首页 上一页 "
else
response.write "<a href=index.asp?key="&key&"&fl="&fl&"&page=1>首页</a> "
response.write "<a href=index.asp?key="&key&"&fl="&fl&"&page=" & Page-1 & ">上一页</a> "
end if
if rs.pagecount-page<1 then
response.write "下一页 尾页"
else
response.write "<a href=index.asp?key="&key&"&fl="&fl&"&page=" & (page+1) & ">"
response.write "下一页</a> <a href=index.asp?key="&key&"&fl="&fl&"&page="&rs.pagecount&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&Page&"</font>/"&rs.pagecount&"</strong>页 "
response.write " 共<b><font color='#FF0000'>"&rs.recordcount&"</font></b>条记录 <b>"&rs.pagesize&"</b>条记录/页" %>

转到第
<select name="page" onChange="javascript:location=this.options[this.selectedIndex].value;">
<%
for d = 1 to Rs.PageCount
if d = page then%>
<option value="index.asp?key=<%=key%>&fl=<%=fl%>&page=<%=d%>" selected><%=d%></option>
<%else%>
<option value="index.asp?key=<%=key%>&fl=<%=fl%>&page=<%=d%>"><%=d%></option>
<%
end if
next
%>
</select> 页
</td>
<%
end if
rs.close
set rs=nothing
%>
...全文
131 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
smart_wl 2008-04-08
  • 打赏
  • 举报
回复
虚心学习,面对未来!
cqzhoulibing208 2008-04-08
  • 打赏
  • 举报
回复
同意..上楼

beyondamane 2008-04-08
  • 打赏
  • 举报
回复
无语,csdn应该开一个新手上路的help.
问一个小问题,贴那么长一段代码.
并且连版本信息的注释都懒得去掉!!!
无语了.....
zhhzhu_it 2008-04-08
  • 打赏
  • 举报
回复
第二个问题换用其他方法解决了,第一个配对问题怎么解决啊?
zhhzhu_it 2008-04-07
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 chinmo 的回复:]
红色部分是匹配位置的问题

<%if rs("hf")="" or rs("hf")=null then%> <span style="font-size: 9pt"> <b>  <font color="#006699">管理员回复: </font> </b> <font color="#006699">暂未回复! </font> <%else%> <b> 
<font color="#006699">管理员回复: </font> </b> <font color="#006699"> <%=rs("hf")%> </font> <%end if%>
[/Quote]

试过了,还是不行哎...
hyjia 2008-04-07
  • 打赏
  • 举报
回复
lz在贴代码!
wanxin2199 2008-04-07
  • 打赏
  • 举报
回复
哎,本来就是回复为空,则显示“暂未回复!”嘛,再学学吧!

<%if rs("hf")="" or rs("hf")=null then%> <span style="font-size: 9pt"> <b>  <font color="#006699">管理员回复: </font> </b> <font color="#006699">暂未回复! </font> <%else%> <b> 
<font color="#006699">管理员回复: </font> </b> <font color="#006699"> <%=rs("hf")%> </font> <%end if%>
  • 打赏
  • 举报
回复
红色部分是匹配位置的问题

<%if rs("hf")="" or rs("hf")=null then%> <span style="font-size: 9pt"> <b>  <font color="#006699">管理员回复: </font> </b> <font color="#006699">暂未回复! </font> <%else%> <b> 
<font color="#006699">管理员回复: </font> </b> <font color="#006699"> <%=rs("hf")%> </font> <%end if%>

zhhzhu_it 2008-04-07
  • 打赏
  • 举报
回复
<form name="form1" method=post action="index.asp">
<td align="center" width="37%" bgcolor="#99CCFF">
<table width="100%" id="table14">
<tr>
<form name="form1" method=post action="index.asp">
<td align="center" width="91%" bgcolor="#99CCFF">
<p align="right">
<input name="key" type="text" class="input" size="16">
<select size="1" name="fl">
<option selected value="1">主题搜索</option>
<option value="2">内容搜索</option>
</select> <input type="submit" value="搜索" name="B1">  </td>
</tr>
</table></td>
</tr>
</table>
<table border="0" width="760" cellspacing="0" cellpadding="0" id="table12" bgcolor="#99CCFF" height="69">
<tr>
<td height="69" align="center" background="bo.jpg" bgcolor="#99CCFF">
<font color="#FFFFFF">随缘网络带审核置顶功能留言簿V1.0   版权所有:<a target="_blank" href="http://www.115cn.cn/"><font color="#FFFFFF">厦门随缘网络科技</font></a> 
制作:<a href="mailto:wuguihua2001@163.com"><font color="#FFFFFF">随缘</font></a>  <script language="javascript" type="text/javascript" src="http://js.users.51.la/473792.js"></script>  </font></td>
</tr>
</table>
</form>
</div>
</body>
</html>

问题一:循环显示后,数据哭中管理员回复字段为空,理应是显示"管理员回复:暂未回复!",可实际显示"管理员回复:"看了代码好象没啥问题呀.
问题二,用Dreamweaver打开,设计窗口看到以上四处红色显示为黄色底纹报错,这是为什么?

请高手指教,谢谢

源代码下载地址:http://www.117cn.cn/book.rar
若白师妹 2008-04-07
  • 打赏
  • 举报
回复
先去学怎么问问题

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧