PDA

Click to See Complete Forum and Search --> : login form please help me out..i need help!!


johnnyboy23
Jan 16th, 2001, 03:15 PM
Im New to asp and currently using DREAMWEAVER Ultradev
to create an web based application system,i have had the biggest learning curve of my life in the last couple of weeks.
im stumpt as to how do i create a login page
with user name and password connected to my access database
it has to have level entry too, for different users for different accesses to different pages of the web based application system.
user enters there user name and password and the database is checked for the user level for the user and takes them to the appropraite page according to theere user level?????

i can do basic forms submit to database and retrieve,update
but not a validation form
please help me out
signed
Stumped

Jan 17th, 2001, 02:36 AM
Hi ...

here a the sample ...

Dim m_User, m_Password, m_DB
Dim dbConn, rsConn
Dim bSuccess

m_User = Trim(Request.Form("Name"))
m_Password = Trim(Request.Form("Password"))

m_DB = Server.MapPath("/Web/ResearchTest/AdminLogin/Db/Login.mdb")
strSQL = "SELECT * FROM tbl_Login"

Set dbConn = Server.CreateObject("ADODB.Connection")
dbConn.Provider = "Microsoft.Jet.OLEDB.4.0"
dbConn.ConnectionString = "Data Source=" & m_DB
dbConn.Open

Set rsConn = Server.CreateObject("ADODB.Recordset")
rsConn.Open strSQL, dbConn,1,3

Do While Not rsConn.EOF
if m_User = rsConn("Login") AND m_Password = rsConn("Password") then
bSuccess = True
Select Case int(rsConn("Level"))
Case 3
Response.Redirect("/Web/ResearchTest/AdminLogin/Asp/Success1.asp")
Case 2
Response.Redirect("/Web/ResearchTest/AdminLogin/Asp/Success2.asp")
Case 1
Response.Redirect("/Web/ResearchTest/AdminLogin/Asp/Success3.asp")
Case Else
End Select
end if
rsConn.MoveNext
bSuccess = False
Loop%>
<%
if bSuccess = False then
Response.Write "<B>Invalid Login Name and Password !</B><BR>"
Response.Write "<a href='/Web/ResearchTest/AdminLogin/Htm/AdminLogin.htm'>Back</a>"
end if

Set dbConn = Nothing
Set rsConn = Nothing
%>

E-mail me if u need a complete code
Good Luck,
Regards,
:o Mac :)