Posts: 24
Location: Soldotna, Alaska
|
First off you need to have a login page. The page should have a form on it that accepts a username and password. When submitted, the form information should go to an ASP page for processing. In the ASP page, check the username and password to make sure it's correct. So like this:
processlogin.asp
Code:
<%
form_username = Request.Form("txtUsername")
form_password = Request.Form("txtPassword")
If form_username = "admin" and form_password = "admin" Then
Session("username") = "admin"
Session("loggedin") = True
Response.Redirect "securepage.htm"
Else
Response.Write "The username or password you have entered are incorrect"
End If
%>
That will do it for processing the login. On the pages you want to be secure. Make a new ASP page then include it at the top of all the pages you want protected. Here is the code for that ASP page:
checklogin.asp
Code:
<%
If Session("loggedin") = False Then
Response.Redirect "login.htm"
End If
%>
So all the files you will need to complete this are:
login.htm (Has two textboxes on it, one called txtUsername and one called txtPassword, form should be submitted to processlogin.asp)
processlogin.asp *
checklogin.asp *
securepage.asp (This page is your secure page with this line put at the top of it: <!--#include file='checklogin.asp'-->)
I have showed you the asterisked ones. I think you will be able to figure out the other pages because I have told you what you need to have on it.
__________________
-Dylan Vester
|