The application of ASP technology in the forum. (vi) (building the full program of the forum, vomiting blood recommended!!!! )

Source: Internet
Author: User
Tags error handling html form
The article publishing module has only two pages, one is the submit.asp used to provide input forms, and one is the subresult.asp for processing form input. The front page is very simple, basically is an HTML form, there is nothing to talk about, the following look at the content of subresult.asp:
< html>
< head>
< title> published articles </title>
< meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
< body bgcolor= "#FFFFFF" >
Author=request ("author")
Password=request ("password")
Topicid=request ("TopicID")
Boardid=request ("Boardid")
Content=request ("content")
Title=request ("title")
This section takes out the table submitted in submit.asp but the contents are placed in the corresponding variable.
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
' Query if the author already exists
Cmd.commandtext = "SELECT * from author table where id= '" & Author & "'"
Set rs = cmd. Execute ()
' Check Permissions
If rs.eof or Rs.bof then
Response.Write "< h3> you have not yet registered, please < a href=register.htm> registration </a> later in to publish articles Response.Write "</body>Response.End
End If
If password< > rs ("password") then
Response.Write "< h2> password error, please check that the password is correct Response.Write "</body>Response.End
End If
This section is the author's permission to check, for the account does not exist or password error to make the appropriate error handling. Here you can see the usage of Response.End, which is used to end the current ASP script. Combined with an If statement, you can handle the expected errors in the program. In a good Web application, error handling is essential.
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: 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.