Say you have these fields
<FORM ACTION="login.asp" METHOD="post">
<TABLE BORDER=0>
<TR>
<TD ALIGN="right">Login:</TD>
<TD><INPUT TYPE="text" NAME="login"></INPUT></TD>
</TR>
<TR>
<TD ALIGN="right">Password:</TD>
<TD><INPUT TYPE="password" NAME="password"></INPUT></TD>
</TR>
<TR>
<TD ALIGN="right"></TD>
<TD><INPUT TYPE="submit" VALUE="Login"></INPUT>
<INPUT TYPE="reset" VALUE="Reset"></INPUT>
</TD>
</TR>
</TABLE>
</FORM>
Your code below:
<%
'**************************************************************************
' This type of script becomes more useful and managable when you are
' comparing these values to those stored in a database or some other source
' of user information instead of hard coding them into the actual code.
' Just be sure that if a data source error arises you don't inadvertantly
' end up giving access to the pages you are trying to protect!
'**************************************************************************
If Request.Form("login" = "Guest" AND Request.Form("password" = "Guest" Then
Response.Write "This is all the <B>cool stuff</B> we are trying to protect!"
Else
Response.Write "Access Denied!"
'*****************************************************************
' Note: we don't use the next line so that our description below
' the script comes in. If you wanted to just stop everything here
' you would un-comment the next line and it would stop execution.
'*****************************************************************
'Response.End
End If
%>
QUOTE OF THE DAY
The only ideas that will work for you are the ones you put to work.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.