欢迎光临
我们一直在努力

动感首页更新实现之五 —— 首页管理篇

建站超值云服务器,限时71元/月

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/

(待续)

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 动感首页更新实现之五 —— 首页管理篇
分享到: 更多 (0)