Protect a page with a password (I)

Source: Internet
Author: User
Tags query password protection
Some pages you may not want to let unrelated people see, such as admin pages. Through a form, a conversation (session) Change, a query statement and its three lines of code to achieve the password protection of the Web page. Susan

First, create a database table named Tbllogin, then create two fields (field names), one called "UserName", and the other is "Password". Set the initial values for two fields so that you can enter the protected page with this initial value.

Next, you need to add a session ("allow") = False in the Session_OnStart of the Global.asa file. When you enter the correct username and password, this value will become true, allowing you to enter the protected page. This session is invoked every time a protected page is accessed.

Below, create a form:

<%@ Language=vbscript%>
<HTML>
<BODY>

<form name= "Login" method= "Post" action= "Login.asp" >
<input type= "text" name= "username" size= "> username<br>"
<input type= "password" name= "password" size= "> password<br>"
<input type= "Submit" Name= "Btnlogin" value= "Login" >
</form>

</BODY>
</HTML>


Name the file containing the above code as main.asp or otherwise.

In the next chapter, we will create a query statement that detects that the user name and password entered are consistent with the database.

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.