PDA

View Full Version : Passwor Protection


Abd
10-02-2002, 06:53 PM
Hi All,

please does any one have a code on password protection that checks username and password in a Database before displaying the required web page

Abd

Carl
10-02-2002, 11:12 PM
Hi adb, Heres my login code for my message board.

<%
username = Request.Form("username")
password = Request.Form("password")

Set conn = Server.CreateObject("ADODB.Connection")
sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\\premfs5\sites\premium10\carlv\database\CBoards\forums.mdb;" & _
"Persist Security Info=False"
conn.Open(sConnection)

sqlLogin = "SELECT username,thepassword FROM Users WHERE username='"&username&"' AND thepassword='"&password&"'"
Set recLogin = conn.Execute(sqlLogin)

if recLogin.EOF Then
Response.Redirect("index.asp?page=login&status=loginbad")
else
Session("CBUsername") = username
Session("CBPassword") = password
Response.Redirect("index.asp?page=login&status=loggedin")
end if

conn.Close
Set conn = Nothing
Set recLogin = Nothing
%>

whammy
10-03-2002, 12:12 AM
I also have one in my signature that requires someone to answer an email before their username and password will let them in.