ASP advanced article Online Management Update (12)

Source: Internet
Author: User
Tags modify microsoft frontpage
Online ASP Advanced article online Management Update-Administrator & column Management

Author: Beach Boy

The previous chapters have basically implemented most of the functions of the article management system, but in this system, the administrator name and password as well as the column update to their own in the database operation, so that does not fully realize the complete system of online management update, so I recently to the management system has been further improved, it added a related function , realize the real sense of the article Management System online Management update!

Implementation of these functions is also through the update of the database and even new content to achieve, where the use of database Operations Command Updata and AddNew is the key, where the Updata, where the use of AddNew here can be reflected, the following for you to introduce their detailed implementation process!

File changepass.asp

"Open the database connection file
<!--#include file= "conn.asp"-->
<%
"Restrict administrative users to access
If Request.Cookies ("Adminok") = "" Then
Response.Redirect "Login.asp"
End If
%>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title> Modify password column information </title>
<meta name= "generator" content= "Microsoft FrontPage 3.0" >
<link rel= "stylesheet" type= "Text/css" href= "Style.css" >
<body>
<div align= "center" ><center>
<font face= italics _gb2312 size=4> web Article Admin Admin page </font>
<table border= "1" width= "80%" bordercolorlight= "#000000" cellspacing= "0" cellpadding= "0"
bordercolordark= "#FFFFFF" >
<%
Dim rs,tsql
Dim rst
"Open recordset admin and display its contents
Set Rs=server. CreateObject ("ADODB.") RecordSet ")
Set Rst=server. CreateObject ("ADODB.") RecordSet ")
Rs.Open "SELECT * from admin", conn,1
%>
<tr>
&LT;TD width= "50%" Align=center><form name=pass method= "POST" action= "changepass.asp" >
<font color=red> Modify Administrator Information </font></td>
&LT;TD width= "50%" rowspan= "4" >* such as Click to change the original password is still displayed, the password has been changed according to your input, you can login to see the new password, or point refresh Select Retry, then the display will be normal! </td>
</tr>
<tr>
&LT;TD width= "50%" align= "Center" >
<input type= "hidden" Name=method value= "Chan" >

"Displays the original administrator name and password in the input field, where you can enter a new username and password directly
<input type= "hidden" name=id value= "<%=rs" ("id")%> ">
Name: <input type= "text" size=10 name= "name" value= "<%=rs (" username ")%>" >
</td>
</tr>
<tr>
&LT;TD width= "50%" align= "center" > Password: <input type= "text" size=10 name= "pass" value= "<%=rs (" password ")%>" >
</td>
</tr>
<tr>
&LT;TD width= "50%" align= "center" ><input name= "Change" class=buttonface value= "Modify" type= ' Submit ' >
</td>
</tr>
</form>
"When the returned method value is prompted to modify the password, the Chan,chan is defined with value in the from where the administrator name and password are filled in, so when Chan is returned it is prompted to modify the password to update the database, otherwise the Updata command will not be executed
<%
Rs.close
If Request ("method") = "Chan" Then
If request ("change") = "Modify" Then
Rs.Open "SELECT * from admin where id=" +request ("id"), conn,1,3
"Use the returned administrator ID to specify and update records in a recordset
RS ("username") =request ("name")
RS ("password") =request ("Pass")
Rs. Update
End If
End If
Rs.close
%>
<tr>
&LT;TD width= "50%" valign= "Top" >
<%
"Open the Display article column recordset
Rst.open "SELECT * from type", conn,1
If rst. EOF Then
Response.Write "No Columns: ("
Else
%><br>
<form name=edittype method= "POST" action= "changepass.asp" >
<p align=center><font color=red> article column Management </font><br>
<%do while not rst. Eof%>

"Display the column in turn, and can be deleted by clicking, modify to do the related operation
<%=rst ("type")%>
<a href= "Changepass.asp?typeid=<%=rst (" typeID ")%>&name=del" > Delete </a>
<a href= "Changepass.asp?typeid=<%=rst (" typeID ")%>&name=edit" > Modify </a>
<br>
<%
Rst. MoveNext
Loop
End If
Rst.close
%>
</form>
"If the returned name is del to prompt the user to click the Delete connection, then the database will be specified to delete the record set
<%
If Request ("name") = "Del" Then
Rst.open "Delete * from type where typeid=" +request ("typeID"), conn,1
Rst.close
End If
%>

"If the returned name is edit, prompts the user to click the Modify button, this time will use the Return column ID (typeid) to display the relevant column operation information, and may fill in inside you want to modify the column name
<%if Reque



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.