manage.asp
Upload User: jinglin
Upload Date: 2021-12-20
Package Size: 545k
Code Size: 4k
Development Platform:

VBScript

  1. <%
  2. if session("ifadm")<>"youarewelcome" then
  3.   response.redirect "../hermesadm/admlogin.asp"
  4. end if
  5. %>
  6. <!--#include file="articleconn.asp"-->
  7. <html>
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  10. <title>管理文件</title>
  11. <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
  12. <link rel="stylesheet" type="text/css" href="css/article.css">
  13. </head>
  14. <%
  15. response.buffer=true
  16.    const MaxPerPage=20 
  17.    dim totalPut   
  18.    dim CurrentPage
  19.    dim TotalPages
  20.    dim i,j
  21.    if not isempty(request("page")) then
  22.       currentPage=cint(request("page"))
  23.    else
  24.       currentPage=1
  25.    end if
  26.    
  27. %>
  28. <body>
  29. <%
  30. dim sql
  31. dim rs
  32. sql="select * from learning order by articleid desc"
  33. Set rs= Server.CreateObject("ADODB.Recordset")
  34. rs.open sql,conn,1,1
  35.   if rs.eof and rs.bof then
  36.        response.write "<p align='center'> 还 没 有 任 何 文 章</p>"
  37.    else
  38.   totalPut=rs.recordcount
  39.       totalPut=rs.recordcount
  40.       if currentpage<1 then
  41.           currentpage=1
  42.       end if
  43.       if (currentpage-1)*MaxPerPage>totalput then
  44.    if (totalPut mod MaxPerPage)=0 then
  45.      currentpage= totalPut  MaxPerPage
  46.    else
  47.       currentpage= totalPut  MaxPerPage + 1
  48.    end if
  49.       end if
  50.                if currentPage=1 then
  51.                     showpages
  52.                     showContent
  53. showpages
  54.            else
  55.          if (currentPage-1)*MaxPerPage<totalPut then
  56.             rs.move  (currentPage-1)*MaxPerPage
  57.             dim bookmark
  58.             bookmark=rs.bookmark
  59.                     showpages
  60.                     showContent
  61. showpages
  62.                   else
  63.         currentPage=1
  64.                    showpages
  65.                     showContent
  66.                    showpages
  67.       end if
  68.    end if
  69.    rs.close
  70.    end if
  71.         
  72.    set rs=nothing  
  73.    conn.close
  74.    set conn=nothing
  75.   
  76.    sub showContent
  77.        dim i
  78.    i=0
  79.   
  80. %>
  81. <div align="center"><center>
  82. <table border="1" cellspacing="0" width="80%" bgcolor="#F0F8FF" bordercolorlight="#4DA6FF"
  83. bordercolordark="#ECF5FF">
  84.   <tr>
  85.     <td width="10%" align="center"><strong><font color="#0080C0">ID 号</font></strong></td>
  86.    
  87.     <td width="50%" align="center"><strong><font color="#0080C0">标 题</font></strong></td>
  88.     <td width="10%" align="center"><strong><font color="#0080C0">修 改</font></strong></td>
  89.     <td width="10%" align="center"><strong><font color="#0080C0">删 除</font></strong></td>
  90. <td width="10%" align="center"><strong><font color="#0080C0">点 击</font></strong></td>
  91. <td width="10%" align="center"><strong><font color="#0080C0">排序</font></strong></td>
  92.   </tr>
  93. <%do while not rs.eof%>
  94.   <tr>
  95.     <td width="10%"><p align="center"><%=rs("articleid")%></td>
  96.  
  97.     <td width="50%"><a href="openarticle.asp?listname=<%=request("listname")%>&id=<%=rs("articleid")%>" target="_blank"><%=rs("title")%></a></td>
  98.     <td width="10%" align="center"><a
  99.     href="edit.asp?id=<%=rs("articleid")%>">修 改</a></td>
  100.     <td width="10%" align="center"><a
  101.     href="delete.asp?id=<%=rs("articleid")%>">删 除</a></td>
  102.    <td width="10%"><p align="center"><%=rs("hits")%></td>
  103.    <td ><p align="center"><%=rs("ctrposition")%>&nbsp</td>
  104.   </tr>
  105. <% i=i+1
  106.       if i>=MaxPerPage then exit do
  107.       rs.movenext
  108.    loop
  109.   %>
  110.   </table>
  111. </center></div>
  112. <%
  113.    end sub 
  114.    sub showpages()
  115.           dim n
  116.    if (totalPut mod MaxPerPage)=0 then
  117.       n= totalPut  MaxPerPage
  118.    else
  119.       n= totalPut  MaxPerPage + 1
  120.    end if
  121.    if n=1 then 
  122.         response.write "<p align='left'><a href=addarticle.asp>创建文章</a>"
  123.      response.write "</p>"
  124.         exit sub
  125.        end if
  126.    dim k
  127.    response.write "<p align='left'>&gt;&gt; 文章分页 "
  128.    for k=1 to n
  129.        if k=currentPage then
  130.           response.write "[<b>"+Cstr(k)+"</b>] "
  131.    else
  132.     response.write "[<b>"+"<a href='manage.asp?page="+Cstr(k)+"'>"+Cstr(k)+"</a></b>] "
  133.    end if
  134.    next
  135.       response.write " <a href=addarticle.asp>创建文章</a>"
  136.    response.write "</p>"
  137.    end sub
  138.  
  139. %>
  140. </body>
  141. </html>