⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.asp

📁 简单的servlet/jsp注册
💻 ASP
字号:
<%
if session("admin_name")="" then
    response.redirect "../index.asp"
	response.end
end if
%>
<!--#include file="../inc/adconn.asp"-->
<link rel="stylesheet" type="text/css" href="../style.css">
<BODY bgcolor="#FFFFFF" marginheight=0 marginwidth=0 leftmargin=5>
<%
   dim totalPut   
   dim CurrentPage
   dim TotalPages
   dim i,j
   const MaxPerPage=8
   if not isempty(request("page")) then
      currentPage=cint(request("page"))
   else
      currentPage=1
   end if
   dim rs
   dim sql
   if not isempty(request("selAnnounce")) then
     idlist=request("selAnnounce")
     if instr(idlist,",")>0 then
       dim idarr
       idArr=split(idlist)
       dim id
       for i = 0 to ubound(idarr)
         id=clng(idarr(i))
         call deleteannounce(id)
       next
     else
       call deleteannounce(clng(idlist))
     end if
   end if 
   set rs=server.createobject("adodb.recordset") 
   sql="Select * from guestbook order by ID desc"
   rs.open sql,conn,1,1  
   if rs.eof and rs.bof then 
        response.write "<p align='center'>对不起,暂时还没有相关信息!!!</p>"%><CENTER> 
<%else 
        totalPut=rs.recordcount 
           if currentpage<1 then 
                 currentpage=1 
           end if 
           if (currentpage-1)*MaxPerPage>totalput then 
	 if (totalPut mod MaxPerPage)=0 then 
	      currentpage= totalPut \ MaxPerPage 
	 else 
	      currentpage= totalPut \ MaxPerPage + 1 
	 end if 
           end if 
           if currentPage=1 then 
               showContent  totalput,MaxPerPage
               showpage totalput,MaxPerPage,"default.asp"
           else 
               if (currentPage-1)*MaxPerPage<totalPut then 
                     rs.move  (currentPage-1)*MaxPerPage 
                     dim bookmark 
                     bookmark=rs.bookmark 
                     showContent  totalput,MaxPerPage
                     showpage totalput,MaxPerPage,"default.asp"
                else 
                     currentPage=1 
                     showContent  totalput,MaxPerPage
                     showpage totalput,MaxPerPage,"default.asp"
               end if 
           end if 
           rs.close 
       end if 
       set rs=nothing
       sub showContent (totalput,MaxPerPage)
%><CENTER>
<br>
<CENTER>
  <TABLE width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#336699"><Form name="search" method="POST" action="default.asp">
    <tr height=25 > 
      <TD width="64" align="center" background="../images/pics/tile_sub.gif"><font color="#FFFFFF"><b>ID号</b></font></TD>
      <TD width="85" align="center" background="../images/pics/tile_sub.gif"><font color="#FFFFFF"><strong>留言人</strong></font></TD>
      <TD width="429" align="center" background="../images/pics/tile_sub.gif"><font color="#FFFFFF"><strong>留言</strong><b>内容</b></font></TD>
      <TD colspan="2" align="center" background="../images/pics/tile_sub.gif"><strong><font color="#FFFFFF">操作</font></strong><strong><font color="#FFFFFF"></font></strong></TD>
      <TD width="84" align="center" background="../images/pics/tile_sub.gif"><font color="#FFFFFF"> 
        <input type='submit' value='删除'>
        </font></TD>
    </TR>
    <%do while not rs.eof%>
    <tr height="20"> 
      <td width="64" height="13" align="center" bgcolor="#ffffff"><font face="Arial"><b><%=rs("id")%></b></font></td>
      <td width="85" align="center" bgcolor="#ffffff"><%=rs("名字")%></td>
      <td width="429" bgcolor="#ffffff"><%=rs("留言")%></td>
      <td width="58" align="center" bgcolor="#ffffff"><a href="reply.asp?id=<%=rs("ID")%>">回复</a></td>
      <td width="65" align="center" bgcolor="#ffffff"><a href="check.asp?id=<%=rs("id")%>">审核<%if rs("check")=true then%><font color="#FF0000">√</font><%end if%></a></td>
      <td width="84" align="center" bgcolor="#ffffff"> <input type='checkbox' name='selAnnounce' value='<%=cstr(rs("id"))%>'></td>
    </tr>
    <tr height="20"> 
      <td height="13" colspan="6" align="center" bgcolor="#ffffff"><%if rs("reply")<>"" then%> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td width="69">&nbsp;</td>
            <td width="97" height="25" background="../images/pics/tile_sub.gif"> 
              <div align="center"><font color="#FFFFFF"><strong>版主回复:</strong></font></div></td>
            <td background="../images/pics/tile_sub.gif"><font color="#FFffff">&nbsp;<%=rs("reply")%></font></td>
          </tr>
        </table>
        <% end if %></td>
    </tr>
    <% i=i+1
   if i>=MaxPerPage then exit do
   rs.movenext
   loop
%>
  </table>
</center>
<%
end sub
function showpage(totalnumber,maxperpage,filename) 
    dim n 
    if totalnumber mod maxperpage=0 then 
       n= totalnumber \ maxperpage 
    else 
       n= totalnumber \ maxperpage+1 
    end if     
   if CurrentPage<2 then 
       response.write "<table border=0 width=100%  cellspacing=0 cellpadding=0 bgcolor=#e8f4ff>" 
       response.write "<tr height=30>"
       response.write "<td align=left>"
       response.write "共<font color=#ff6600><b>"&n&"</b></font>页&nbsp;第<font color=#ff6600><b>"&CurrentPage&"</b></font>页&nbsp;共检索到<font color=#ff6600><b>"&totalnumber&"</b></font>条相关信息</td>" 
       response.write "<td align=right>"
       response.write "【最前页】【上一页】" 
  else 
       response.write "<table border=0 width=600 cellspacing=0 cellpadding=0 bgcolor=#e8f4ff>"
       response.write "<tr height=30>"
       response.write "<td align=left>"
       response.write "共<font color=#ff6600><b>"&n&"</b></font>页&nbsp;第<font color=#ff6600><b>"&CurrentPage&"</b></font>页&nbsp;共检索到<font color=#ff6600><b>"&totalnumber&"</b></font>条相关信息</td>" 
       response.write "<td align=right>"
       response.write "【<a href="&filename&"?page=1&txtitle="&request("txtitle")&">最前页</a>】" 
       response.write "【<a href="&filename&"?page="&CurrentPage-1&"&txtitle="&request("txtitle")&">上一页</a>】&nbsp;" 
 end if 
   if n-currentpage<1 then 
       response.write "【下一页】【最后页】" 
  else 
      response.write "【<a href="&filename&"?page="&(CurrentPage+1)&"&txtitle="&request("txtitle")&">" 
      response.write "下一页</a>】【<a href="&filename&"?page="&n&"&txtitle="&request("txtitle")&">最后页</a>】" 
  end if 
  response.write "</td>"
  response.write "</tr>"
  response.write "</table>"
  response.write "</form>"
end function
sub deleteannounce(id)
  dim rs,sql
  set rs=server.createobject("adodb.recordset")
  sql="delete from [guestbook] where id="&cstr(id)
  conn.execute sql
   if err.Number<>0 then
     err.clear
     response.write "删 除 失 败 !<br>"
   end if
End sub
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -