The application of ASP technology in the forum

Source: Internet
Author: User
Use session to maintain authentication of the owner, which must require that the client browser's cookie be opened. Because the session is implemented through cookies. Here, the Kanban ID is assigned to the session variable Beenthere, indicating that the owner has passed the authentication. In each subsequent version of the page, check to see if the Beenthere and the corresponding version ID match.

Url= "boardmanager.asp?boardid=" & Boardid

Response.Redirect URL

When the beginning of the ASP is always for Response.Redirect This method is confused, repeatedly with uncomfortable, now I come to tell you some skills. Before you can use it, you must use the Response.buffer=true to make the ASP page work with buffers. At this point, before the ASP is interpreted as HTML code, it is placed in a buffer instead of being sent directly to the client browser. Another must know is that no actual HTML code can be sent to the client browser before using Response.Redirect, otherwise there will be an error. Of course, there are workarounds, if the HTML code has been interpreted before Response.Redirect, you can use the Response.Clear method to clear the buffer, and then you can use it for redirection.

End If

%>

   

The following page is the target of redirection after authentication passed: boardmanager.asp. It will list all the articles that have not been processed.

<%

Boardid=request ("Boardid")

If session ("Beenthere") < >boardid then Response.Redirect "Forums.asp"

This is the test of the identity of the site, because the previous cookie in the owner's browser has been marked, now we can through the seesion to identify the identity of the owner. If the logo does not match, it will return to the first landing page via Response.Redirect. If the cookie in the owner's browser is not open, the value of Seesion ("Beenthere") will be empty and the page cannot be entered.

Set conn = Server.CreateObject ("ADODB. Connection ")

Conn. Open "Driver={microsoft Access driver (*.mdb)};d bq=" & Server.MapPath ("Bbssystem.mdb")

Set cmd = Server.CreateObject ("Adodb.command")

Set cmd. ActiveConnection = conn

Sql= "SELECT name from Kanban list where id=" & Boardid

Set Rs=conn.execute (SQL)

Boardname=rs ("name")

cmd.commandtext= "List of unpublished articles"

ReDim param (0) ' statement

Param (0) = CLng (boardid) ' Cint cannot be ignored

Set rs = cmd. Execute (, param)

Set cmd=nothing

%>

< html>

< head>

< title> edition Processing </title>

< meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">


< body bgcolor= "#FFFFFF" >

< H1 align= "center" ><%=boardname%> Board Management
< hr>

<%

If rs.eof or Rs.bof then Response.Write "< h2> there are no articles to deal with
Response.End

%>

If no new articles are posted by netizens, this gives the appropriate hints and ends the display of this page with Response.End.

< table width= "90%" border= "0" cellspacing= "0" cellpadding= "0" align= "center" >

< tr bgcolor= "#FFFFCC" >

< TD width= "40%" height= "> Theme </TD>"

< TD width= "40%" height= "a" > article title </td>

< TD width= "8%" height= "a" > author </td>

< TD width= "12%" height= "a" > Date </td>

</tr>

<%

Todo

Topicid=rs ("Subject ID")

Articleid=rs ("article ID")

Data=rs ("date")

DATASTR=CSTR (Year (data)) & "-" & CStr (month (data) & "-" & CStr (data)

Author=rs ("author")

Articlename=rs ("title")

Topicname=rs ("Subject")

  

Response.Write "< tr>< td>< a href=qtopic.asp?topicid=" & TopicID & ">" & topicname & "&L T /a></td> "

Response.Write "< td>< a href=managearticle.asp?articleid=" & ArticleID & "&boardid=" & Boardid & ">" & ArticleName & "</a></td>"

Response.Write "< td>< a href=qauthor.asp?author=" & author & ">" & author & "</a></ Td> "

Response.Write "< td>" & Datastr & "</td></tr>"

Rs.movenext

Loop until rs.eof

%>

</table>


<%

Set rs=nothing

Conn.close

Set conn=nothing

%>

</body>

When the link to the corresponding article is clicked, enter the processing page of this article managearticle.asp:

<%

Articleid=request ("ArticleID")

Boardid=request ("Boardid")

If session ("Beenthere") < >boardid Then



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.