Use ASP to create a personalized forum

xiaoxiao2021-03-06  41

Researry address: http://www.5xsoft.com/data/200110/2508070601.htm

Preface: Now there is a situation everywhere, but I don't know if you have encountered this situation: I am looking for what I want in the messy discussion information. It is a very expensive thing. Later, you will I don't want to see what forum. So can we increase audit functions on the content of our website forum? That is, all netizens sent to the forum, and it is not immediately displayed. After the webmaster or moderator review, it is considered valuable. It is necessary to recommend it to other netizens, and published. Otherwise, it will be deleted, so exclusted to waste space, it is a bit like the meaning of the essence, so your forum can be provided to clearly beneficial content than a general forum. Put it on your website, you should attract more users to visit. This idea can of course be realized, let me briefly introduce how to make it. Note: Since this article applies to readers with a certain understanding of the Access database, HTML, ASP.

I. Forum structure analysis, through the above functional demand analysis, we can divide the forum into four parts: (1) Netizen registration and management module: Because the webmaster or moderator, you must be able to Perform authentication. The function of this module is to manage the registered netizen and provide relevant queries. For example, query all published articles of the author of the author, query the top ten netizens who currently publish the most articles, and so on. If your forum is not very big, this module can omit the function with only the moderator authentication, and remove the part about registration, query. (2) Article display module: Show all version of the primary audina, feel a recommended article. (3) Post article module: Provide a place where the registered netizen provides the publication, and release the master review. (4) Article Review Module: The moderator is handled for all the nets published but unreviewed articles, which have been decided to be published or deleted. After understanding the specific functional requirements, you can design it by the module's start forum. Of course, these modules are only functional to the forum structure, which is actually unable to independently design them. For this smaller applications, there is no need to perform a complete modular design, which is more simple to write directly to the program code under good plan. There are general two ways to implement for the forum: file or database. Relatively, the database is simple and efficient, and it is possible to better control the forum, and some verification and protection can be provided. I am using the Access database here, and Access should be competent for general small and medium-sized applications.

From the above analysis, you can know that there should be four tables, below I give the structure of each table. (1) the author list (used to store the author message): ID: Text type, required. It is a netizen code. Password: Text type, required. Nickname: Text type, mustal. Email: Text type, required. Position: Digital type, required. -1 represents ordinary netizens, 0 represents the webmaster. Digital representative version of greater than 0, and the number is the ID of a plate in the table table, indicating that the board of the board. Number of articles: Digital type, required. The total number of articles published by netizens. Name: Text type, optional. Gender: Text type, optional. Phone: Text type, optional. (2) Content table (used to store specific articles content and related messages): ID: Auto number and set index to speed up the speed of search. Plate ID: Digital Type, from the list of board, indicating that the article is a board. Theme ID: Digital Type, from the topic table, indicating the topic of the article. Author ID: Text type, from the author table, indicating the author of the article. Date: Date / Time Type, preset initial value is a function now (), the system will automatically take the system current time to its value when adding this field. Title: Text Type. The title of the article. Published: Yes / No Type, indicates that the article has passed the review, you can publish it; "No" means that the article is still looking for. Recommendation: Digital Type, Recommendation of Articles. Content: Note type, specific content of the article. Clicks: Digital Type, Clicking on Articles. (3) List of boards (used to store messages related to the board): ID: Auto number, the same, also set indexing. Name: Text type, the name of the board. Plate, text type, ID. Numms: Digital Types, the number of topics included in the board. (4) Topic table (to store messages related to topics): ID: Auto number and set indexing. Title: Text type, indicating the topic name. Watch: Digital Type, from the list of board, indicating the board to which the theme belongs. Number of articles: Digital type, number of articles included in the subject. All the table is designed, but the database is not finished, so we also need to establish an intervivinary relationship, so that the database can perform some relevant inspections, avoid information errors. Another benefit of establishing an inter-mean relationship is that it can easily establish a complex Join inquiry. Usually, when we operate in the ASP, it is used to execute the query generated when using it, and then interpret it by the delivery to the database. And here we need to store inquiry. Compared with the execution, the pre-depreciation has more advantages. It is saved in the database, independent of the ASP program code, making him easier to establish and modify, and the query is more efficient, faster, you can debug it in the ASP page, can avoid many problems. Moreover, the ASP program code that stores queries is easier to read and modified.

It may be very annoying, especially those commaings,, especially those commaings, numerals, one thing that is not careful. After using the storage query, you don't have to take care of these problems. Of course, there are some places to pay attention to in the pre-depreciation process, and I will explain it in detail later. Establishing a pre-depression in Access is a very easy thing, I will not say more. I only give the SQL statement program code for each query. I put all the queries you want to use as the pre-deposit program in the database, and some of the following: (1) Press the ID query article: SELECT topic table. Title AS theme name, list. Name AS Code name, Content table. * From theme table inner Join (Content Table Inner Join Watch List ON Content Table. Watch ID = List. Id) ON Topic Table .ID = Content Table. Theme Idwhere ((Content Table .id) = [ArticleID] ]); (2) Primitive password query: SELECT board list. Board owner, the author Table. Password from the author Table Inner Join board list ON author Table. ID = List of boards. Planner WHERE ((((List of board .id) = [id]; (3) Search for authors:. SELECT * FROM tABLE authors of table WHERE (((author table .ID) = [id])); (4) published an article listing: SELECT [table of contents] [ID. ], [Content Table], [Content Table]. [Author ID] AS Author, [Content Table]. [Date], [Content Table]. [Recommendation], [Content Table]. [Clicks ] AS Click on the number .FROM Content Table Where (([Content Table]. [Topic ID]) = [Topicindex]) And ([Content Table]. [Published]) = true)); No Article list: SELECT Content table. ID AS article ID, theme table. ID AS topic ID, theme table. Title AS topic, content table. Title AS title, content table. Author ID AS author, content table. Date AS date from theme table Inner Join content Table ON Topic Table. Id = Content Table. Topic IDwhere ((Content Table. Published) = false) and ((Content Table. Watch ID) = [BoardID])); (5) Topic List: SELECT Topic Table. * List of boards. Name AS Plate name from FROM List Inner Join Theme table on the board list. Id = Table. Wanches WHERE (((Top Table. Watch) = [BoardIndex])); there are some queries because most classs I will not list it. In the above query statement, I can see something surrounded by "[" and "]", that is, the query parameters. Need to give parameter values ​​when executed, then Bring the parameter value into the query statement to be executed. Also, what is important is: When establishing those INNER JOIN queries, it is necessary to add the intervals to the design view, otherwise it is not possible to automatically generate InN. Er Join query statement. At this point, the database is designed, and the future work is ASP.

Second, build

1. Build a master form to give a form, allowing users to enter registration messages, these are HTML content, and put it on one side, let's take a closer look at the ASP script that specifically implemented registered. (1) Change the single quotes in the information to two single quotes, and add single quotation markstr = "" "and" End Function Note: "End Function Note: This is a custom function that converts single quotes () in user input into two single quotes (). In ASP, the string is surrounded by double quotes, and the above "" "means that only one single quotes are character. The reason why a single quotation is replaced with two single quotes, because in the SQL statement, use single quotes to represent variables. In order not to confuse, you should use both single quotes in the string to represent two single quotes. All user inputs are embedded as variables into the SQL statement, so this function is essential. (2) Storage Preparation ID = Request ("ID") Password = Request ("Password") Nickname = Request ("Nickname") Email = Request ("email") SEX = Request ("sex") Note: Put from The content in the user enters the form is saved in the variable, which is not necessary, but it is easier to read and write. if Request ("Name") = "" "" "" "" ") =" "" ") =" "" "" "" "

Because these contents do not have to be filled, in order to prevent the user from entering anything, but cause an error on the database operation, it is necessary to replace the field without filling the field. (3) Establish a connection set conn = server.createObject ("AdoDb.Connection") Conn.open "Driver = {Microsoft AccessDriver (* .mdb)}; dbq =" & Server.mAppath ("bbssystem.mdb")

Note: This section is to establish a database connection, the name of the database is bbssystem.mdb, the only thing to note in this paragraph is the application of the server.mappath function. In general, anywhere involving a specific directory, do not use the directory name directly, and replace it with the server.mappath function. Good use of functions such as Server.MAppath and Request.ServerVariables () to make your web application have better portability. SET cmd = server.createObject ("adodb.command")

(4) Query if the author has set cmd.activeconnection = conncmd.commandtext = "Query author" Redim param (0) Statement parameter array param (0) = cstr (ID) CINT cannot ignore SET RS = cmd.execute (, Param Note: This is used to perform pre-depreciation procedures. There are many ways to perform queries in ADO, but you can only use Command objects for the pre-depreciation. First, establish a Command object called CMD, then set the CONN connection object to the ActiveConnection property of the CMD object, set the query name "Query the author" to be executed to the CommandText property, then assign a value for the query parameter. We declare a parameter array param (0) because there is only one parameter in the "Query Author" query, so an array has only one component. In general, there are several parameters in the query, it is necessary to declare an array of parameters in the number of corresponding components. And the order in which the parameters appears is the order of the components in the array. In the process of using the parameter query, it is important to note that the type of parameters must be strictly matched, and if this will be wrong, the above CSTR () type conversion function is indispensable. If not (rs.eof or rs.bof) ThenRESPONSE.WRITE "error, the ID number you entered is already occupied, please try again!" ElseSQL = "Insert Into author Table (ID, nickname, email, password, Name, School, Series, Gender, Phone) Values ​​("SQL = SQL & SQLSTR (ID) &", "SQL = SQL & SQLSTR (Nickname) &", "SQL = SQL & SQLSTR (Email) &", " SQL = SQL & SQLSTR (PASSWORD) & "," SQL = SQL & SQLSTR (Name) & ", &", "SQL = SQL & SQLSTR (SEX) &", "SQL = SQL & SQLSTR (Phone) &") Conn.execute SQL

Insert the data into the database using a SQL INSERT statement. In fact, this inquiry can also be made in the database. I stole my little lazy :-) However, it can also see the benefits of the pre-depreciation program, and it is too much trouble when the query is written.

2. Build a article shows that the module says that a specific article is subrouting under the board and subject. So the display of the article is also available after the list of lists and main lists can be obtained, and the list of articles under specific topics can be obtained. (1) Display page of the board: list </ title> <meta http-equiv = "content-type" content = "text / html; charSet = GB2312> </ head > <%</p> <p>(2) Open the connection, display the board list set conn = server.createObject ("adodb.connection") conn.open "Driver = {Microsoft AccessDriver (* .mdb)}; dbq =" & Server.mAppath ("bbssystem.mdb ") SQL =" SELECT * FROM list "SET RS = Conn.execute (SQL)%> Note: Simple SQL query, transfer all the relevant messages to the record RS. The following tasks are to display records, and establish a connection to the topic of the board on the corresponding board name. <body bgcolor = "# ffffff"> <h2 align = "center"> list </ h2> <table width = "60%" border = "0" cellspacing = "0" cellpadding = "0" align = "center "> <tr bgcolor =" # fffccc "> <td height =" 35 "width =" 25% "> board name </ td> <td height =" 35 "width =" 21% "> board master </ td > <td height = "35" width = "23%"> topics </ TD> <TD Height = "35" width = "31%>" The main landing </ td> </ TR></p> <p>Note: Part of this is the title of each column in the table, which I have not used a unified function to display the contents of the RS audio, because this can do more control on the appearance and style of the table. Although it is a bit troublesome But it is more flexible. <% DOBOARDID = RS ("ID") BoardName = RS ("Name") BoardManager = RS ("Plate Main") response.write "<tr> <td> <a href = qboard.asp? BoardId =" & BoardID & & BoardName = "& BoardName &"> & BoardName & "</ a> </ td>"</p> <p>Note: This line is a focus. After clicking the name of each board, you can connect to the page displayed topic. The program code looks a bit trouble, I decomposed to you, you will understand. After clicking, the browser request is using the QBoard.asp page, and has a parameter boardID that represents the ID number to display the board, separated by the question mark (?) Between the request page and the parameters. BoardID is the variable set in front, which contains corresponding</p> <p>The ID number of the board. This connection also has another parameter boardName for passing the name of the board to the QBoard.asp page. Use "&" between multiple parameters. This parameter is not necessary, passing the past is to use BoardID in QBORAD.ASP to query the board name. In general, it is possible to use less database operations, which can improve the performance of the ASP page. Because the response.write statement uses a string as the parameters, the "&" linkage is used between the string and variables above. The result of the final ASP page interpretation should be like this <TD> <a href = qboard.asp? BoardId = 1 & BoardName = System Board> System Board </ a> <TD>. Response.write "<TD> <a href = QAUTHOR.ASP? Author =" & BoardManager & "& BoardManager &" </A> "<TD>" & RS ("topics") & "</TD>"Response.write" <TD> <a href = managerLogin.asp? BoardId = "& BoardID &"> Plate Processing </ a> </ td> </ tr> "Note: In this table In addition to the content of the board theme, there is also a bamboo query section and a board processing section. The moderator query can be implemented by qauthor.asp. It is just a simple author message from the database, and Show out, there is not much to say it here. The board processing is processed by the ManagerLogin.asp page. This belongs to the article review module, I will say later. Rs.MovenextLoop Until Rs.eof%> Note: All messages in records are displayed through a DO ... Loop loop. </ table> <div align = "center"> <br> Click on the name of the board to get the topic list, click the board main name to check the main message </ div> </ body> </ html> <% set = NothingConn .closset conn = Nothing%></p> <p>(3) Creating QBaord.asp Pages: <% BoardId = Request ("BoardID") Remove the board ID number set conn = server.createObject ("adoDb.connection") conn.open "" Driver = {"DRIVER = { Microsoft AccessDriver (* .mdb)}; dbq = "& Server.MapPath (" bbssystem.mdb ") Set cmd = Server.CreateObject (" ADODB.Command ") Set cmd.ActiveConnection = conncmd.CommandText =" topic list "ReDim Param (0) // Note: Declaration parameter array param (0) = clng (BoardID) // Note: CLNG does not ignore SET RS = cmd.execute (, param)%> <html> <head> <title> topic list </ title> <meta http-equiv = "content-type" content = "text / html; charSet = GB2312"> </ head> <body bgcolor = "# ffffff"> <h1 align = "center"> <% = RS ("Cabo Name")%> Board Topic List </ h1> <Table Width = "80%" Border = "0" cellspacing = "0" cellpadding = "0" align = "center"> <tr bgcolor = "#Fffccc"> <td width = "89%" Height = "21"> Topic </ td> <td width = "11%" height = "21"> number of articles </ td> </ tr> <% Dotopicid = RS ("ID") TopicName = RS ("Title") SUM = RS ("Article Number of Articles) Response.write" <TR> <TD> <a href = qtopic.asp? Topicid = "& TopiciD &" & BoardName = "& BoardName &"> & TopicName & "</ a> </td>"response.write" <TD> "& SUM &" </ TD> </ in "rs.movenextLoop Until Rs.eof%> </ table> </ body> </ html></p> <p>Note: QBoard.asp lists all the topics under a layout, and will enter the corresponding topic article after clicking the topic name. This list is implemented by qtopic.asp ASP scripts. Qtopic.asp's program code is almost almost almost different from QBoard.asp, but there is a difference in their respective details, which is not intended to talk more. (4) After clicking on the article title in the list of articles, you will enter the article content browsing page article.asp: <% articleid = request ("articleid") set conn = server.createObject ("adodb.connection" conn.open "driver = {Microsoft AccessDriver (* mdb.)}; dbq =" & Server.MapPath ( "bbssystem.mdb") Set cmd = Server.CreateObject ( "ADODB.Command") Set cmd.ActiveConnection = conncmd.CommandText = " Press ID Query Articles "Redim Param (0) Declaration Param (0) = Clng (ArticleID) CINT Do not ignore SET RS = cmd.execute (, param) Author = RS (" Author ID ") Title = rs (" Title ") Data = RS ("Date") Rate = RS ("Recommendation") BoardID = RS ("Plate ID") TopiciD = RS ("Topic ID") BoardName = RS ("Top Name) TopicName = RS (" Theme ")") Content = RS ("Content") Content = Replace (Content, VBCRLF, "</ P> <P>") Content = "<P>" & Content & "</ P>" Note: This is an important Note that in the content field is included in the content field, it can contain a charter character. In the HTML display, you must change the wrap characters (that is, the VBCRLF constant) to the paragraph symbol of HTML. In this way, in the direction of the paragraph and the paragraph, it will not chaos the format of the original input. If you want to design more, you can reset the <p> tag by CSS, set its Test-Indent property, you can implement each of the start spaces. (5) Add a SQL = "Update content table SET =" Update content table SET number = Clicks 1where id = "& articleidconn.execute SQL</p> <p>Note: There is a SQL statement here. When the page is displayed, you will click on the number of numbers in the corresponding table, so you can make statistics on the number of articles browsing and can be ranked in order. When the statement is executed, I found: Originally in the SQL statement, the embedded variable name should add single quotes to the difference, but I didn't add single quotes on the articleid variable here, actually can pass, and I I used to write this way to cause errors, I don't know if it is due to the new version of ADO.</p> <p>Set cmd = nothing%> <html> <head> <title> Untitled Document </ Title> <meta http-equiv = "content-type" content = "text / html; charSet = GB2312> </ head> <body> <body> <body> <body> <body> </ head> <body> </ head> <body> </ head> <body bgcolor = "# E9E9E4"> <table width = "89%" border = "0" cellspacing = "0" cellpadding = "0" align = "center"> <tr bgcolor = "# CCCCCC"> <td> author: <font color = "# ff3366"> <a href="qauthor.asp?author=< %=author% "> <% = author> </ a> <font> Posted: <font color =" # Ff3333> <% = DATA%> </ font> Watch: <font color = "# fput ="> <a href="qboard.asp?boardid= "%=BoardID%"> <% = boardname%> </ a> </ font> board main recommendation: <font color = "# ff3333"> # Rate # </ font> </ td> </ tr> <tr bgcolor = "# cccccc"> <td> title: <font color = "# ff3333"> <% = title%> topic: <a href = "qtopic.asp? Topicid = <% = TopicID%>> <% = TopicName%> </ a> </ font> </ td> </ tr> <tr valign = "top"> <td> <hr> <font color = "# FF3366"> article content: </ font> <br> <br> <font color = blue> <% response.writecontent%> </ font> <br> <br> </ td> </ tr> <tr valign = "top"> <td height = "18"> <table width = "50%" border = "0" Cellspacing = "0" cellpadding = "0" align = "right"</p> <p>BGColor = "# cccccc"> <tr> <td width = "0%> </ td> <td width =" 65% "> About this topic <a href =" Submit.asp? TopiciD = <% = TopicID %> & BoardId = <% = BoardID%>> Publishing </ a> </ td> This connection allows netizens to express their opinions on this comment, this is the next module to talk about, here and press No table below. </ tr> </ table> </ td> </ tr> </ table> </ body> </ html> <% set = nothingconn.closset conn = Nothing%> To this, the article display section is also completed . Let's take a look at how the article is implemented.</p> <p>3. Building an article Publishing some articles publishing the module has only two pages, one is the Submit.asp used earlier to provide input forms, and one is used to handle the SubResult.asp for processing the form.. The front page is very simple, basically a html form, nothing to say, let's take a look at the contents of SubResult.asp: <html> <head> <title> publish Articles </ title> <meta http- Equiv = "Content-Type" Content = "text / html; charSet = GB2312"> </ head> <body bgcolor = "# ffffff"> <% author = request ("author") password = request ("password") Topicid = Request ("Topicid") BoardID = Request ("BoardID") Content = Request ("Content") title = request ("Title")</p> <p>Note: This section takes out the table submitted in Submit.asp but placed in the corresponding variable. <html> <head> <title> Publish articles </ title> <meta http-equiv = "content-type" content = "text / html; charSet = GB2312"> </ head> <body bgcolor = "# ffffff" > <% author = request ("author") Password = request ("password") Topicid = Request ("Topicid") BoardId = Request ("BoardID") Content = Request ("Content") title = request ("Title" )</p> <p>(1) Query if the author has a cmd.commandtext = "SELECT * FROM author table where id =" & author & "" set = cmd.execute () (2) Check permission cmd.commandtext = "SELECT * FROM author table WHERE ID = "& author &" "set = cmd.execute ()</p> <p>Note: This section is checked for author rights, and makes corresponding error processing for accounts do not exist or password errors. It can see the usage of Response.end here, which is used to end the current ASP script. Combined with the IF statement, the expected error in the program can be processed. In a good Web application, error handling is essential. (3) Change the single quotes in the information to two single quotes, and add single quotes Function SQLSTR (Data) SQLSTR = "" & Replace (DATA, "," ") &" "End Function write Database SQL = "INSERT INTO content table (" SQL = SQL & SQLSTR (TopiciD) & "," SQL = SQL & SQLSTR (BoardID) & "," SQL = SQL & SQLSTR (BoardID) & " = SQL & SQLSTR (Author) & "," SQL = SQL & SQLSTR (Title) & "," SQL = SQL & SQLSTR (Content) & ")" Conn.execute SQL%> <H2> Article has been sent to the database After the board is the main review, you can see <H2> </ body> </ html></p> <p>To this, the article has been saved in the database. However, it is not able to be displayed immediately, but also the approval of the moderator. Let's take a look at the content of the management part of the forum.</p> <p>4. The management part of the forum is the core of our forum, but it doesn't have any special place. Still those old things: form processing, database query, combining them organically with ASP. After entering the article review mode (the above-mentioned board processing), the most primrose should be verified by the identity of the moderator. Let's take a look at the moderator landing page: <% BoardId = Request ("BoardID")</p> <p>(Note: BoardID is passed by the connection to this page, is the ID of the board to handle the board. By it can know that the board is processed.) SET CONN = ERVER.CREATEOBJECT ("AdoDB .Connection ")</p> <p>Conn.open "Driver = {Microsoft AccessDriver (* .mdb)}; dbq =" & Server.mappath ("bbssystem.mdb") set cmd = server.createObject ("adoDb.command") set cmd.activeconnection = conncmd. CommandText = "Board Main Code Query" Redim Param (0) Param (0) = Clng (BoardID) // Note: ClNG is not ignored SET RS = cmd.execute (, param) BoardManager = RS ("board main") SET CMD = NOTHING%> <html> <head> <title> Untitled Document </ title> <meta http-equiv = "content-type" content = "text / html; charSet = GB2312> </ head> <body bgcolor = "#Fffffff"> <p> Only the owner <% = BoardManager> can enter this place </ p> <p> Please enter the verification password, and open the browser's cookies in order to keep authentication. </ p> <form method = "post" action = "managerLoginRest.asp> <input type =" password "name =" password "> <input type =" hidden "name =" boardid "value = <% = BoardID % >> <input type = "submit" name = "Submit" value = "OK"> </ form> Note: This page is only used to log in, it is not validated after the password entered by the bamboo, it does not verify it. Instead, the verification work is put in the next page. In fact, the work of password input and verification is that it can be done in a page, which is a bit troublesome only on the structure arrangement of the program code. </ body> </ html> <% set = nothingconn.closset conn = Nothing%></p> <p>Now get the moderator ID and the password, the following is the working managerLoginRest.asp for verification, it accepts the content of the form in the file above, and performs related processing: <% response.buffer = true</p> <p>Note: Set the buffer to allow for use. This general, is the head of each ASP page, which can improve the performance of the ASP page. After opening the buffer, there are some corresponding special methods in the ASP, which will be mentioned later. BoardId = Request ("BoardID") Password = Request ("password") set conn = server.createObject ("adodb.connection") conn.open "driver = {microsoft accessdriver (* .mdb)}; dbq =" & Server . Mappath ("bbssystem.mdb") set cmd = server.createObject ("adodb.command") set cmd.activeconnection = conncmd.commandtext = "Board master password query" redim param (0) declared param (0) = CLNG BoardID) // Note: CLNG is not negligible SET RS = cmd.execute (, param) BoardManager = RS ("Board") if password <> rs ("password") THEN%> <html> <head> <Title> Authentication </ Title> <meta http-equiv = "content-type" content = "text / html; charSet = GB2312"> </ head> <body bgcolor = "# fff"> password error </ body> </ HTML> <% elsesession ("beenthere") = Boarded Note: Use session to keep the original authentication of the moderator, which must be required to be opened. Because Session is implemented by cookie. Here, give the board ID to the session variable beenthere, indicating that the master has passed authentication. In the page processed after each version of the following, check whether Beenthere is consistent with the corresponding viewing ID. URL = "BoardManager.asp? BoardId =" & BoardIdResponse.Redirect URL</p> <p>Supplement: When I beginpass ASP, I always feel confused for response.redirect this method. It is not cool. Now I will tell you some tips. Before using it, you must use the response.buffer = true to let the ASP page use buffers. At this time, before the ASP is explained as an HTML program code, it is placed in the buffer, and the client browser that is not directly transmitted. There is also a must know that before using Response.Redirect, you can't have any actual HTML program code to be sent to the client browser, otherwise it will be wrong. Of course, there is also a variable method. If you already have an HTML program code before response.Redirect, you can use the Response.clear method to clear the buffer, and then you can use it to make a reset. End IF%> Note: The following is the target of the reset to the object: BoardManager.asp. It will list all articles that have been processed. <% BoardID = Request ("BoardID") IF session ("beenthere") <> BoardidThen response.Redirect "forums.asp" Note: This is the place to test moderator, because the front has passed cookie in the browser in the bamboo Mark, now we can identify the identity of the moderator through seeion. If the label does not match, return to the first landing page via Response.Redirect. If the cookie of the moderator browser is not open, the value of the seesion ("beenthere") is empty, and it is also unable to enter this page.</p> <p>Set conn = server.createObject ("adodb.connection") conn.open "Driver = {Microsoft AccessDriver (* .mdb)}; dbq =" & Server.mappath ("bbssystem.mdb") set cmd = server.createObject ( "AdoDb.command") set cmd.activeconnection = connSQL = "SELECT Name" WHEREID = "& BoardidSet RS = conn.execute (SQL) BoardName = RS (" Name ") cmd.commandtext =" Not published in the article " Redim param (0) PARAM (0) = clng (BoardID) // Note: CLNG does not ignore SET RS = cmd.execute (, param) set cmd = nothing%> <html> <head> <title> 版 处理 处理 处理/ title> <meta http-equiv = "content-type" content = "text / html; charSet = GB2312"> </ head> <body bgcolor = "# ffffff"> <h1 align = "center"> <% = BoardName%> 版 管理理 </ h1> <hr> <% if xi ee r.bof the response.write "<H2> There is no article to handle </ h2>" response.end%> Note: The new article is released by netizens, which gives the corresponding prompt and uses Response.end to end this page.</p> <p><table width = "90%" border = "0" cellspacing = "0" cellpadding = "0" align = "center"> <tr bgcolor = "# fffcc"> <td width = "40%" height = "20 "> Topic </ td> <TD width =" 40% "Height =" 20 "> Article title </ td> <td width =" 8% "Height =" 20 "> Author </ td> <td width = "12%" Height = "20"> Date </ td> </ tr> <% dotopicid = rs ("Topic ID") ArticleId = RS ("Article ID") DATA = RS ("Date" Datastr = CSTR (Year (DATA) & "-" & CSTR (DATA) & "-" AUTHOR = RS ("Author" Articles Articles - TopicName = RS ("Title") TopicName = RS "Topic") response.write "<tr> <td> <a href=qtopic.asp?topicid="& TopiciD&" & TopicName & "</ a> </td> "Response.write" <TD> <a href = managearticle.asp? ArticleId = "& articlei) & BoardId =" & BoardID & "> & articlename &" </ a> </td>"response.write "<TD> <a href = QAUTHOR.ASP? Author = "& author &"> & author & "</ a> </td>"response.write" <TD> "& Datastr &" </ TD> </ in "rs.movenextLoop Until Rs.eof%> < / table> </ html> <% set rs = nothingconn.closeset conn = nothing%> </ body> when you click the link for the article, this article will enter the processing page managearticle.asp: <% articleid = request ( "ArticleID") BoardId = Request ("BoardID") IF session Beenthere ") <></p> <p>boardidthen response.redirect "forums.asp" Set conn = Server.CreateObject ( "ADODB.Connection") conn.Open "driver = {Microsoft AccessDriver (* .mdb)}; dbq =" & Server.MapPath ( "bbssystem.mdb ") SET cmd = server.createObject (" adoDb.command ") set cmd.activeconnection = conncmd.comMandText =" Press ID Query Articles "Redim param (0) param (0) = clng (ArticleID) // Note: CLNG is not Ignore SET RS = cmd.execute (, param) Author = RS ("Author ID") Title = RS ("Title") DATA = RS ("Date" Rate = RS ("Recommendation") BoardId = rs (" ") TopiciD = RS (" Topic ID ") BoardName = RS (" Top Name) TopicName = RS ("Topic Name) Content = RS (" Content ") Content = Replace (Content, VBCRLF," </ P> <p> ") Content =" <p> "& content &" </ p> "set cmd = not%> <html> <head> <title> Untitled Document </ Title> <meta http-equiv =" Content-type "content =" text / html; charSet = GB2312 "> </ head> <body bgcolor =" # e9e9e4 "> <table width =" 89% "Border =" 0 "cellspacing =" 0 "cellpadding =" 0 "align =" center "> <tr bgcolor =" # CCCCCC "> <td> author: <font color =" # FF3366 "> <a href="qauthor.asp?author=< %=author%>"> <% = author> </ a> </ font> Posted: <font color = "# ff3333"> <% = data%> </ font > Write: <font color = "# fput color =" # ff3333 "> <a href="qboard.asp?boardid=< %=BoardID%"> <% = boardname%> </ a> </ font> board main recommendation:</p> <p><font color = "# ff3333"> # rate # </ font> </ td> </ tr> <tr bgcolor = "# cccccc"> <td> Title: <font color = "# ff3333> <% = Title%> Topic: <a href = "qtopic.asp? TopiciD = <% = TopicID%>> <% = TopicName%> </ a> </ font> </ td> </ tr> <tr Valign = "top"> <td> <hr> <font color = "# FF3366"> article content: </ font> <br> <br> <font color = blue> <% response.writecontent%> </ font> < Br> <hr> </ td> </ tr> <tr Valign = "TOP"> <form method = "post" action = "manageresult.asp"> <td height = "18"> <table width = "100 % "border =" 1 "cellspacing =" 1 "cellpadding =" 1 "> <tr> <td width =" 29%> <div align = "right"> <input type = "hidden" name = "boardid" Value = "<% = BoardID%>> <input type =" hidden "name =" topicid "value =" <% = TopicID%> "> <input type =" hidden "name =" articleid "value =" < % = ArticleID%>> Article Processing: </ div> </ td> <td width = "12%" bordercolor = "# 006666"> Delete: <input type = "radio" name = "management" value = 1 > </ td> <td width = "30%" bordercolor = "# 006666"> Published: <input type = "radio" name = "management" value = 2></p> <p>Recommended grade <select name = "select"> <option value = "1"> 1 </ option> <option value = "2"> 2 </ option> <option value = "3" SELECTED> 3 </ option> <option value = "4"> 4 </ option> <option value = "5"> 5 </ option> </ select> </ td> <td width = "20%" bordercolor = "# 006666"> Destip: <input type = "radio" name = "manage" value = 3> </ td> <TD width = "9%"> <input type = "submit" name = "submit" value = "OK"> </ td> </ tr> </ table> </ td> </ form> </ tr> </ table> </ body> </ html> <% set = nothingconn.closset conn = nothing%> Note : This page and the article showing Article.asp in the module is basically the same, just add the form of the moderator processing, not more here. Below, to repair the corresponding part of the database according to the moderator, repair the corresponding part of the database <% "<html> <head> <title> Article processing </ title> <meta http-equiv =" content-type " Content = "text / html; charSet = GB2312"> </ head> <body bgcolor = "# e9e9e4"> <% articleid = request ("articleid") boardID = request ("BoardID") Topicid = Request ("TopiciD" ) Manage = Request ("manage") Accept form content response.write manage Shows Bamboo IDIF Session ("Beenthere") <> BoardIdThen Response.Redirect "forums.asp" set conn = server.createObject ("adodb.connection") Conn.open "Driver = {Microsoft AccessDriver (* .mdb)}; dbq =" & Server.mappath ("bbssystem.mdb") According to the operation of the moderator on the previous page, the corresponding processing is performed below.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-70776.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="70776" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.042</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'FCK26q5yfWK_2Bs6iyZHh4IJXYj8Wy5uRzYtGqnTt4lU1jJIyGyPlLPDcbVSu5sRbsCdiRRxhKTzHmg2gr'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>