VSpeed wrote:hm.. yes, that's a problem
Is there a way to make the "dim LoggedIn" a global variable to a few asp pages?
Global variables should be avoided if you are talking about something like the PHP Register Globals. You could use a SESSION to pass along the fact that you have already logged in. Here is a complete header.aspx for a simple login that I wrote... I tried to explain it the best I could and i wrote this a few years ago, so It could probably be simplified even more...
- Code: Select all
' CHECK FOR LOGIN
If Session("LoggedIn") <> "true" Then
' IF NOT LOGGED IN, SEE IF FORM WAS SUBMITTED
If Request.Form("login") = "UserName" AND Request.Form("password") = "Password" Then
Response.Write "<p>PASSWORD VERIFIED</p>"
Response.Write "<p><a href='mainpage.asp'>Click Here To Continue</a></p>"
' CORRECT USER AND PASS, SO SET A SESSION HERE
Session("LoggedIn") = "true"
' USER AND PASS NOT SET, SO DISPLAY LOGIN FORM
Response.Write "Enter login information:"
<TD><INPUT TYPE="text" NAME="login"></INPUT></TD>
<TD><INPUT TYPE="password" NAME="password"></INPUT></TD>
<TD><INPUT TYPE="submit" VALUE="Login"></INPUT>
<INPUT TYPE="reset" VALUE="Reset"></INPUT>
' END LOGIN CHECK
' LOAD REST OF THE PAGE, CLOSE STATEMENT IN FOOTER.ASP WITH ANOTHER END IF
Now.. just FYI... once you start setting sessions or passing variables along from one page to another.. your script becomes less secure.