2013-08-01 91 views
0

我需要显示多个ASP项目。我们有一个后端工具,可以添加多个条目,但只显示前两个条目。我希望只是一些小的代码调整,可以显示其他页面。对于2页时显示的代码的代码如下:显示多个ASP项目

<% 
dim sql 
sql = "select * from announcement_table where ann_status=1" 
set rs = con.execute(sql) 
%> 
<%if not(rs.eof and rs.bof) then%> 
<p><strong><%=rs("ann_title")%></strong> </p> 
<p><%=rs("ann_text")%> 
    <%else%> 
    Currently there are no announcements. 
    <% 
end if 
rs.close 
set rs = nothing 
%> 
</p> 
<hr size="1" noshade> 
<% 
dim sql_, sqlcount 
sqlcount = "select count(*) from announcement_table" 
set rscount = con.execute(sqlcount) 
sql_ = "select * from announcement_table where ann_status <> 1" 
set rs_ = con.execute(sql_) 
%> 
<%if rscount(0)>1 then%> 
<%if not(rs_.eof and rs_.bof) then%> 
<a href="announcements_more.asp?ann_id=<%=rs_("ann_id")%>"><%=rs_("ann_title")%></a>   <br> 
    <%else%> 
    Currently there are no announcements. 
    <% 
end if 
rs_.close 
set rs_ = nothing 
%> 
<%end if 
rscount.close 
set rscount = nothing 
%> 

这是第2页:

<% 
dim sql_ 
sql_ = "select * from announcement_table where ann_id=" & intann_id 
set rs_ = con.execute(sql_) 
%> 
<p><strong><%=rs_("ann_title")%></strong> </p> 
<p><%=rs_("ann_text")%></p> 

<%rs_.close 
set rs_ = nothing 
%> 
+1

你好,SQL注入漏洞。第二页的代码实际上是乞求被黑客攻击。 –

+0

如果我是唯一可以访问该页面的页面,该页面是否可以被黑客入侵?这是一个后端工具,只有我可以访问,所以我不会太在意黑客,除非我有错误,并且以其他方式访问它?这种工具已经有15年的历史,只要黑客没有问题。 – dmwesq

回答

1
在第二页

,你需要遍历记录显示多个值。

<% 
    dim sql_ 
    sql_ = "select * from announcement_table where ann_id=" & intann_id 
    set rs_ = con.execute(sql_) 

    While Not rs_.EOF 
    %> 
    <p><strong><%=rs_("ann_title")%></strong> </p> 
    <p><%=rs_("ann_text")%></p> 

    <% 
    rs_.Movenext 
    Wend 
    rs_.close 
    set rs_ = nothing 
    %> 

并检查此链接。 SQL Injection