ASP advanced article Online Management Update (10)

Source: Internet
Author: User
Tags goto modify prev microsoft frontpage
The password and password verification of the article management system is described earlier. Through the password authentication can restrict the general visitor to enter the page, here wants to restrict is the ordinary user cannot enter the page, namely includes manages the page, deletes the article page, modifies the article page as well as modifies the user information and modifies the column information the page. In fact, here is the main management page and article management system page similar to the page, just added some related to the management of the content of the connection, in order to facilitate the manager of the article online modify delete operations.

The following is to introduce the main program content of this page, because it and article management of the homepage is similar, so here is just to write out its program, and annotated and the main page different places, other similar parts please refer to the Seventh section of this topic!

File manage.asp

The Open database connection
<!--#include file= "conn.asp"-->
<%
"Restrict access to unmanaged users, as described in section seventh of this topic
If Request.Cookies ("Adminok") = "" Then
Response.Redirect "Login.asp"
End If
%>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
Special Topics </title> <title>asp skills
<meta name= "generator" content= "Microsoft FrontPage 3.0" >
<link rel= "stylesheet" type= "Text/css" href= "Style.css" >
<script language= "JavaScript" >
function Popwin2 (Id,path)
{window.open ("openarticle.asp?id=" +id+ "&ppath=" +path, "", "Height=450,width=600,resizable=yes,scrollbars=yes , Status=no,toolbar=no,menubar=no,location=no ");
}
</script>
<%
Const MAXPERPAGE=18
Dim totalput
Dim currentpage
Dim totalpages
Dim i,j
If not IsEmpty (Request ("page") Then
Currentpage=cint (Request ("page")
Else
Currentpage=1
End If
Dim sql
Dim rs
Dim Rstype
Dim typesql
Dim typeid,typename
If not IsEmpty (Request ("typeID")) Then
Typeid=request ("typeID")
Else
Typeid=1
End If
Set Rstype=server.createobject ("Adodb.recordset")
Typesql= "SELECT * from type where typeid=" &cstr (typeid)
Rstype.open typesql,conn,1,1
If not rstype.eof then
Typename=rstype ("type")
End If
Rstype.close
Set rstype=nothing
%>
<body>
<div align= "center" ><center>
<table border= "0" width= "92%" cellspacing= "0" cellpadding= "0" >
<tr>
&LT;TD width= "100%" style= Border-left:thin dotted rgb (0,128,0); Border-right:thin dotted rgb (0,128,0) "><p align=" center "><br>
Dynamic Network ASP Skills >><font color= "#FF0000" ><%response.write "" &typename& ""%></font><br >
<center>
<a href= "manage.asp?typeid=1" >asp tutorials </a>|<a href= "manage.asp?typeid=2" >ASP faq</a>|<a href= "manage.asp?typeid=3" >asp Digest </a>
|<a href= "manage.asp?typeid=4" >asp instance </a>|<a href= "manage.asp?typeid=5" >asp security </a>|

"Display System Admin page related connection, used to modify admin password name and add modify Delete column, this will be introduced in the following
<a href= "changepass.asp" title= "to modify Admin password name and add modify Delete column" ><font color=red> admin page </font></a>
<div align= "center" ><%
Sql= ' SELECT * from article where typeid= ' +cstr (typeid) + "ORDER BY data 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 ' > hasn't had any articles </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
ShowPage totalput,maxperpage, "manage.asp"
Showcontent
ShowPage totalput,maxperpage, "manage.asp"
Else
if (currentPage-1) *maxperpage<totalput Then
Rs.move (currentPage-1) *maxperpage
Dim bookmark
Bookmark=rs.bookmark
ShowPage totalput,maxperpage, "manage.asp"
Showcontent
ShowPage totalput,maxperpage, "manage.asp"
Else
Currentpage=1
ShowPage totalput,maxperpage, "manage.asp"
Showcontent
ShowPage totalput,maxperpage, "manage.asp"
End If
End If
Rs.close
End If

Set rs=nothing
Conn.close
Set conn=nothing


Sub Showcontent
Dim i
I=0

%>
<div align= "center" ><center><table border= "1" cellspacing= "0" width= "589" bordercolorlight= "#000000" bordercolordark= "#FFFFFF" cellpadding= "0" >
<tr>
&LT;TD width= "align=" "Center" bgcolor= "#D0D0D0" height= "><strong>id" </strong></td>
&LT;TD width= "align=" "Center" bgcolor= "#D0D0D0" ><strong> article title </strong></td>
&LT;TD width= "align=" "Center" bgcolor= "#D0D0D0" ><strong> modification </strong></td>
&LT;TD width= "align=" "Center" bgcolor= "#D0D0D0" ><strong> Delete </strong></td>
</tr>
<%do While not rs.eof%>
<tr>
&LT;TD height= "width=" ><p align= "center" ><%=rs ("ArticleID")%></td>
&LT;TD width= "><p align=" center "><a href=" javascript:popwin2 (<%=rs ("ArticleID")%>) ">< %=rs ("title")%></a></td>

"Shows the relevant connection to the deletion of the modification, as described in the following sections
&LT;TD width= "><p" align= "center" ><a
href= "Edit.asp?id=<%=rs (" ArticleID ")%>" > Modify </a></td>
&LT;TD width= "><p" align= "center" ><a
href= "Delete.asp?id=<%=rs (" ArticleID ")%>" > Delete </a></td>
</tr>
<% i=i+1
If I>=maxperpage then Exit Do
Rs.movenext
Loop
%>
</table>
</center></div><%
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
Response.Write "<form method=post action=" &filename& "typeid=" &typeid& ">"

"Show additional articles related links, about adding articles in section first to second of this topic
Response.Write "<p align= ' center ' ><a href= ' addarticle.asp?typeid= ' &typeid&" ' ><font color= ' Red ' > Add Article </font></a> '
If Currentpage<2 Then
Response.Write "<font color= ' #000080 ' > Home prev </font>"
Else
Response.Write "<a href=" &filename& "page=1&typeid=" &typeid& "> Home </a>"
Response.Write "<a href=" &filename& "page=" &CurrentPage-1& "&typeid=" &typeid& "> Prev </a> "
End If
If N-currentpage<1 Then
Response.Write "<font color= ' #000080 ' > Next End </font>"
Else
Response.Write "<a href=" &filename& "page=" & (currentpage+1) & "&typeid=" &typeid& " > "
Response.Write "Next page </a> <a href=" &filename& "page=" &n& "&typeid=" &typeid& " > Last </a> "
End If
Response.Write "<font color= ' #000080 ' > page: </font><strong><font color=red>" &CurrentPage & "</font><font color= ' #000080 ' >/" &n& "</strong> page </font>"
Response.Write "<font color= ' #000080 ' > Total <b>" &totalnumber& "</b> article <b>" & maxperpage& "</b> article/Page </font>"
Response.Write "<font color= ' #000080 ' > Goto: </font><input type= ' text ' name= ' page ' size=4 maxlength=10 Class=smallinput value= "&currentpage&" > "
Response.Write "<input class=buttonface type= ' Submit ' value= ' Goto ' name= ' Cndok ' ></span></p></ Form> "
End Function
%>
</div></td>
</tr>
</table>
</center></div>
</body>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.