Submit a Site

 


ASP Quick And Easy Login Module

November 22nd, 2007 | by valiik |

I had to quickly post this one here. I’ve been using this quick and easy, static login script on multiple ASP applications. Just copy tha code, paste it into your code, set a password and it’s ready to go. Don’t forget to change the login form action value.

<%@ Language=VBScript

Option Explicit

Dim bLogInSaved, cmd, pw ””””””””””””””””””
‘ SET YOUR PASSWORED HERE
pw = “password”

””””””””””””””””””

If Session(”letin”) = “allow” Then
bLogInSaved = True
else
bLogInSaved = False
End If

If Request.Form(”password”) <> “” Then
If Request.Form(”password”) = pw Then
Session(”letin”) = “allow”
bLogInSaved = True
else
bLogInSaved = False
End If
End If

If Request.QueryString(”logout”) = “1″ Then
Session.Contents.RemoveAll
bLogInSaved = False
End If

If bLogInSaved Then

%>

<p> PASSWORD PROTECTED PAGE GOES HERE </p>

<%
Else

Response.Write “<center><form name=”"login”"” & _
” method=”"post”" action=”"ThisPagesName.asp”">” & _
“<table width=”"345″” border=”"0″” cellspacing=”"0″” ” & _
“cellpadding=”"0″”><tr><td width=”"190″”>” & _
“<font size=”"2″” face=”"Arial, Helvetica, sans-serif”">” & _
“Please enter the Password:</font> </td>” & _
“<td width=”"155″”><input type=”"text”" ” & _
“name=”"password”"></td></tr></table>” & _
“</form></center>”

End If

%>

Post a Comment