Code for restricted access to webpages using ASP

Source: Internet
Author: User

 

You can modify the red section below.

<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb_2312-80">
<Meta name = "generator" content = "Microsoft FrontPage express 2.0">
<Style>
<! --
. As {Line-Height: 15px; font-size: 9pt}
A: hover {color: #0033f0; text-Decoration: underline}
. P9 {font-family: ""; font-size: 9pt; line-Height: 15pt}
. P12 {font-family: ""; font-size: 12pt; line-Height: 18pt}
A: link {text-Decoration: none ;}
A: visited {text-Decoration: none ;}
A: hover {text-Decoration: underline; font-size: 125%; color: Blue}
-->
</Style>
<Title> restricted webpage access </title>
</Head>
<Body background##back.jpg ">
<%
'Use request. servervariables ("remote_addr") to obtain the IP address and save it in the rip variable.
Rip = request. servervariables ("remote_addr ")
Strip = CSTR (RIP)
'Obtain the value of the third segment of the IP address and save it to strip.
For I = 1 to 2
Strip = right (strip, Len (strip)-instr (1, strip, ".")
Next
Strip = left (strip, instr (1, strip, ".")-1)
'The IP address validity test and password verification, including two aspects:
'Verification is performed if the IP address meets the requirements. If the IP address does not match the requirements, check whether the entered password is correct (the password here is "asp ")
If (left (RIP, 5) <> "127.1" or strip <"1" or strip> "50") and request ("passwd") <> "asp" then
%>
<P> <font color = "# ff0000"> sorry, your IP address is <% = rip %>. You are not a user of this website <br> </font> </P>
<Form action = "demo. asp" method = "Post" id = form1 name = form1>
<P> enter the access password: <input type = "password" name = "passwd"> <input type = "Submit" value = "OK" name = "B1">;
</P>
</Form>
<% Else %>
'Congratulations, you have successfully passed the page security certification and can directly use the resources on this site!
<% End if %>
</Body>
</Html>

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.