帝国软件
  设为首页 加入收藏 关于我们
 
解密帝国网站管理系统
栏 目:
 
您的位置:首页 > 技术文档 > ASP编程
动感首页更新实现之五 ------ 首页管理篇
作者: 发布时间:2005-03-12 来源:
manage.asp
'管理页同首页显示篇差不多,这里阿喔只介绍如何连接删除链!
'见尾页
<%
if request.cookies("adminok")="" then
  response.redirect "login.asp"
end if
%>
<!--#include file="articleconn.asp"-->
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理文件</title>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<link rel="stylesheet" href="../css/style.css">
</head>
<%
   const MaxPerPage=40
   dim totalPut   
   dim CurrentPage
   dim TotalPages
   dim i,j

   if not isempty(request("page")) then
      currentPage=cint(request("page"))
   else
      currentPage=1
   end if
   
%>
<body bgcolor="#FFFFFF">
<p>&nbsp;</p>
<table width="90%" border="1" cellspacing="0" cellpadding="0" align="center" bordercolorlight="#000000" bordercolordark="#FFFFFF">
  <tr bgcolor="#99CCFF">
    <td height="10">
      <div align="center"><b>管 理 界 面</b></div>
    </td>
  </tr>
  <tr>
    <td height="49"><%
dim sql
dim rs
sql="select * from learning order by articleid desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
  if rs.eof and rs.bof then
       response.write "<p align='center'> 还 没 有 任 何 文 章</p>"
   else
  totalPut=rs.recordcount
      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
                    showpages
                    showContent
showpages
           else
         if (currentPage-1)*MaxPerPage<totalPut then
            rs.move  (currentPage-1)*MaxPerPage
            dim bookmark
            bookmark=rs.bookmark
                    showpages
                    showContent
showpages
                  else
        currentPage=1
                   showpages
                    showContent
                   showpages
      end if
   end if
   rs.close
   end if
        
   set rs=nothing  
   conn.close
   set conn=nothing
  

   sub showContent
       dim i
   i=0
  
%>
      <table border="1" cellspacing="0" width="90%" bgcolor="#F0F8FF" bordercolorlight="#000000"
bordercolordark="#FFFFFF" align="center">
        <tr>
          <td width="10%" align="center"><strong>ID 号</strong></td>
          <td width="54%" align="center"><b>主 题</b></td>
          <td width="15%" align="center"> <b>时 间</b></td>
          <td width="11%" align="center"><strong>删 除</strong></td>
        </tr>
        <%do while not rs.eof%>
        <tr>
          <td width="10%" height="3">
            <p align="center"><%=rs("articleid")%>
          </td>
          <td width="54%" height="3">
            <div align="center"></div>
            <div align="left"><%=rs("title")%></div>
          </td>
          <td width="15%" height="3">
            <div align="center"><%=rs("dateandtime")%></div>
          </td>
          <td width="11%" align="center" height="3"><a
    href="delete.asp?id=<%=rs("articleid")%>">删 除</a></td>
        </tr>
        <% i=i+1
      if i>=MaxPerPage then exit do
      rs.movenext
   loop
  %>
      </table>
      <p><%
   end sub

   sub showpages()
          dim n
   if (totalPut mod MaxPerPage)=0 then
      n= totalPut MaxPerPage
   else
      n= totalPut MaxPerPage + 1
   end if
   if n=1 then
        response.write "<p align='left'><a href=addarticle.asp>创建文章</a>"
     response.write "</p>"
        exit sub
       end if

   dim k
   response.write "<p align='left'>&gt;&gt; 文章分页 "
   for k=1 to n
       if k=currentPage then
          response.write "[<b>"+Cstr(k)+"</b>] "
   else
      response.write "[<b>"+"<a href='manage.asp?page="+cstr(k)+"'>"+Cstr(k)+"</a></b>] "
   end if
   next
      response.write " <a href=addarticle.asp>创建文章</a>"
   response.write "</p>"
   end sub


%></p>
    </td>
  </tr>
</table>
<div align="center">
  <center>
    <p align="center">《<a href="http://asp.on.net.cn/" target="_blank">ASP动感在线</a>》编辑制作</p>
  </center>
</div>

</body>
</html>

大家注意的是:
<a href="delete.asp?id=<%=rs("articleid")%>">删 除</a>
关系者要删除内容的位置,要不然KILL错了就麻烦了!

作者:阿喔   出处:<ASP动感在线> http://asp.on.net.cn/

                           (待续)
  
评论】【加入收藏夹】【 】【打印】【关闭
※ 相关链接
 ·动感首页更新实现之一 ------ 首  (2005-03-12)
 ·动感首页更新实现之二 ------ 首  (2005-03-12)
 ·动感首页更新实现之三 ------ 数  (2005-03-12)
 ·动感首页更新实现之四 ------ 首  (2005-03-12)

   栏目导行
  PHP编程
  ASP编程
  ASP.NET编程
  JAVA编程
   站点最新
·致合作伙伴的欢迎信
·媒体报道
·帝国软件合作伙伴计划协议
·DiscuzX2.5会员整合通行证发布
·帝国CMS 7.0版本功能建议收集
·帝国网站管理系统2012年授权购买说
·PHPWind8.7会员整合通行证发布
·[官方插件]帝国CMS-访问统计插件
·[官方插件]帝国CMS-sitemap插件
·[官方插件]帝国CMS内容页评论AJAX分
   类别最新
·在ASP中使用数据库
·使用ASP脚本技术
·通过启动脚本来感受ASP的力量
·学习使用ASP对象和组件
·解析asp的脚本语言
·初看ASP-针对初学者
·ASP开发10条经验总结
·ASP之对象总结
·ASP与数据库应用(给初学者)
·关于学习ASP和编程的28个观点
 
关于帝国 | 广告服务 | 联系我们 | 程序开发 | 网站地图 | 留言板 帝国网站管理系统