ASP to write a message board (2)

Source: Internet
Author: User

4. log on

As mentioned above, login is a query. It mainly depends on the login processing page.Checklogin. asp

 

<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> test logon </title>
</Head>
<Body>
<%
Username = request. Form ("username ")
Password = request. Form ("userpwd ")
'Connect to the database below and create a connection object instance DB
Dim DB
Set DB = server. Createobject ("ADODB. Connection ")
DB. Open "DBQ =" & server. mappath ("data. mdb") & "; driver = {Microsoft Access Driver (*. mdb )}"
// Query SQL statements
Strsql = "select * from user where username = '" & username & "' and userpwd = '" & password &"'"
Set rsmongodb.exe cute (strsql)
If Rs. EOF then
Response. Write "incorrect user name or password"
Else' successful
Session ("un") = username // save to the session, and the page will judge the permission call
Session ("up") = Password
Response. Redirect ("index. asp") // redirect to the Home Page
End if
Set rs = nothing

%>
</Body>
</Html>
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.