newbieprogramme
09-12-2005, 03:48 PM
Hi-
I am trying to password protect my website so that members are the only ones allowed in to the interesting content :)
Here is what is going on:
There is a FORM called where users log in:
<form action="/FOLDER/test.asp" method="post" name="memberform">
<table cellspacing="0" cellpadding="3" align="center">
<tr>
<td>
<div align="center">
<input type="text" name="Username" value="Username" size="15">
</div>
</td>
<td rowspan="2" width="53">
<div align="right">
<a href="javascript:document.memberform.submit();">
<img src="/images/login.gif" width="49" height="23" border="0">
</a>
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<input type="text" name="Password" value="Password" size="15">
</div>
</td>
</tr>
</table>
</form>
End FORM
There is a page called TEST.ASP which contains the following:
CheckLogin = 0
Checks for previous cookies for basic users
If Request.Cookies("LoggedIn") = "1" Then
CheckLogin = 1
End If
Checks for previous cookies for advanced users
If Request.Cookies("AdvLoggedIn") = "1" Then
CheckLogin = 1
End If
Checks User ID and PW from the form and creates a cookie as needed for advanced users
If Request.Form("Username") = "ADVANCED" and Request.Form("Password") = "sunshine" Then
CheckLogin = 1
Response.Cookies("AdvLoggedIn") = "1"
Response.Cookies("LoggedIn") = "1"
End If
Checks User ID and PW from the form and creates a cookie as needed for basic users
If Request.Form("Username") = "BASIC" and Request.Form("Password") = "smile" Then
CheckLogin = 1
Response.Cookies("LoggedIn") = "1"
End If
Checks the cookie and directs BAD logins to the invalid page
If CheckLogin = 0 Then
Response.Redirect("/FOLDER/invalid.asp")
End If
Checks the cookie and directs GOOD logins to the membersonly page
If CheckLogin = 1 Then
Response.Redirect("/FOLDER/membersonly.asp")
End If
End TEST.ASP
In the HEADER of each protected page there is a link to a check of the cookies:
#include virtual="/FOLDER/-check.asp"
End HEADER check
The -CHECK.ASP page looks almost identical to the TEST.ASP page. In anycase It is not working. I am directed to invalid no matter what and I cannot figure out where I went wrong!
Thanks!
I am trying to password protect my website so that members are the only ones allowed in to the interesting content :)
Here is what is going on:
There is a FORM called where users log in:
<form action="/FOLDER/test.asp" method="post" name="memberform">
<table cellspacing="0" cellpadding="3" align="center">
<tr>
<td>
<div align="center">
<input type="text" name="Username" value="Username" size="15">
</div>
</td>
<td rowspan="2" width="53">
<div align="right">
<a href="javascript:document.memberform.submit();">
<img src="/images/login.gif" width="49" height="23" border="0">
</a>
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<input type="text" name="Password" value="Password" size="15">
</div>
</td>
</tr>
</table>
</form>
End FORM
There is a page called TEST.ASP which contains the following:
CheckLogin = 0
Checks for previous cookies for basic users
If Request.Cookies("LoggedIn") = "1" Then
CheckLogin = 1
End If
Checks for previous cookies for advanced users
If Request.Cookies("AdvLoggedIn") = "1" Then
CheckLogin = 1
End If
Checks User ID and PW from the form and creates a cookie as needed for advanced users
If Request.Form("Username") = "ADVANCED" and Request.Form("Password") = "sunshine" Then
CheckLogin = 1
Response.Cookies("AdvLoggedIn") = "1"
Response.Cookies("LoggedIn") = "1"
End If
Checks User ID and PW from the form and creates a cookie as needed for basic users
If Request.Form("Username") = "BASIC" and Request.Form("Password") = "smile" Then
CheckLogin = 1
Response.Cookies("LoggedIn") = "1"
End If
Checks the cookie and directs BAD logins to the invalid page
If CheckLogin = 0 Then
Response.Redirect("/FOLDER/invalid.asp")
End If
Checks the cookie and directs GOOD logins to the membersonly page
If CheckLogin = 1 Then
Response.Redirect("/FOLDER/membersonly.asp")
End If
End TEST.ASP
In the HEADER of each protected page there is a link to a check of the cookies:
#include virtual="/FOLDER/-check.asp"
End HEADER check
The -CHECK.ASP page looks almost identical to the TEST.ASP page. In anycase It is not working. I am directed to invalid no matter what and I cannot figure out where I went wrong!
Thanks!