The application of ASP technology in the Forum (VII.)

Source: Internet
Author: User
This may be the heart of our forum, but it is nothing special to realize. Or those old things: Form processing, database query, in the use of ASP to integrate them organically.

When entering the article review mode (referred to the Board processing), the most important content, should be the identity of the owner to verify. Here's a look at the owner landing page:

<%

Boardid=request ("Boardid")

The Boardid is passed through the link entering this page, is the ID of Kanban that is to be handled by the board. It is through it to know that the board is dealing with the board.

  

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

Cmd.commandtext = "board Master password Query"

ReDim param (0) ' statement

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

Set rs = cmd. Execute (, param)

Boardmanager=rs ("board Master")

Set cmd=nothing

%>

< html>

< head>

< title>untitled document</title>

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


< body bgcolor= "#FFFFFF" >

< p> only board main <%=boardmanager%> can enter this place </p>

< p> Please enter the authentication password and, in order to remain authenticated, open the browser's cookies. </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>

This page is only used for landing, it gets the password entered by the moderator, and can not be validated, but the validation of the work on the next page. In fact, the work of password input and validation can be done in one page, but the structure of the code is a bit cumbersome.

</body>


<%

Set rs=nothing

Conn.close

Set conn=nothing

%>

Now get the owner ID and enter the password, the following is the validation of the work managerloginrest.asp, it accepts the above file in the form of the content, and related processing:

<%

Response.buffer=true

Set the buffer to allow use. In general, this should be added to the header of each ASP page, which can improve the performance of ASP pages. After opening the buffer, there are some special usages in the ASP, which are mentioned later.

Boardid=request ("Boardid")

Password=request ("password")

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

Cmd.commandtext = "board Master password Query"

ReDim param (0) ' statement

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

Set rs = cmd. Execute (, param)

Boardmanager=rs ("board Master")

If password< > rs ("password") then%>

< html>

< head>

< title> authentication </title>

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


< body bgcolor= "#FFFFFF" >

Bad password

</body>


<%

Else

Session ("Beenthere") =boarded



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.