How to create a secure page?

Source: Internet
Author: User

How to create a secure page?

Manage. asp

'Logon page.

<% @ Language = VBScript %>
<Html>
<Body>
<Form name = "Login" method = "Post" action = "login. asp">
<Input type = "text" name = "username" size = "20"> User name <br>
<Input type = "password" name = "password" size = "20"> password <br>
<Input type = "submit" name = "btnLogin" value = "login">
</Form>
</Body>
Login. asp
'Verify the username and password entered in the form.

<% @ Language = VBScript %>
<% Response. Buffer = True %>

<Html>
<Body>

<% Session ("allow") = True %>

<%
UserName = Request. Form ("username ")
Password = Request. Form ("password ")
'Capture the form content.

Set MyConn = Server. CreateObject ("ADODB. Connection ")
MyConn. Open "connection string"

SQL = "Select * From tblLogin"
Set RS = MyConn. Execute (SQL)

If UserName = RS ("UserName") AND Password = RS ("Password") Then
'If yes, the page to be protected is displayed.
%>
Bytes ----------------------------------------------------------------------------------------------------------------
'Place the content of the page to be protected.
Bytes ----------------------------------------------------------------------------------------------------------------
<%
Else
Response. Redirect "http://www.intels.net/login.asp"
RS. Close
MyConn. Close
Set RS = Nothing
Set MyConn = Nothing
End If
%>
'If not, return to the logon page and ask the user to log on again.

</Body>
Now, let's do the final application work. Add the following code to the front of the page to be protected:
<% @ Language = VBScript %>
<% Response. Buffer = True %>
<% If session ("allow") = False Then Response. Redirect "manage. asp" %>

Note: For more exciting tutorials, please follow the help houseWebpage Design tutorialTopic,

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.