| If you just need to password protect a single page or a series of pages and you don't need multiple users this simple code can be pasted at the top of the page or pages. In this version of the code we use a cookie to keep track of the password access so the user does not have to log in again when they come back to the page or pages.
You can change the password in the code. It is set to "sample" right now.
All you need to do is make sure the form posts to itself.
For example: If the page you paste this code into is called "guestbook.asp"
You would change the action of the form to "guestbook.asp".
Paste the code below directly under the
<%@ LANGUAGE="VBSCRIPT" %> on your asp page.
<%
Response.Buffer = True
STATUS = Request("STATUS")
PASSWORD = Request("PASSWORD")
If STATUS = "CHECKEM" Then
If PASSWORD = "sample" THEN
Response.Cookies ("PASSWORDACCESS")("Access") = "Yes"
Response.Cookies ("PASSWORDACCESS").Expires = DATE + 256
End If
End If
If Request.Cookies("PASSWORDACCESS")("Access") <> "Yes" Then
%>
..................................
html here
............................................
<%
Response.End
End If
%> |