aklo
06-22-2005, 06:28 AM
I have a webpage which is stored in the computer. I use the IIS to make a site so i can view it like: http://localhost/nameofsite
I have a login system..which basically does:
1. checks for a User name and password in Microsoft Access database.
<!--#include file="adovbs.inc"-->
<!--#include file="msadox.dll"-->
<%
dim con,rs
set con=server.CreateObject("ADODB.Connection")
set rs=server.CreateObject("ADODB.Recordset")
with con
.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("password.mdb")& ";Persist Security Info=false"
.open
end with
with rs
.ActiveConnection=con
.CursorType=adopendynamic
.LockType=adlockoptimistic
.CursorLocation=aduseclient
.Open "Select * from auth"
end with
name1=Request.form("txtname")
pass=Request.form("txtpass")
do while not rs.EOF
if trim(name1)=trim(rs("user")) and trim(pass)=trim(rs("pass")) then
found=true
exit do
end if
rs.moveNext
loop
Response.Clear()
if found then
response.redirect("choice.html")
else
response.redirect("error.html")
end if
%>
2. Now i enter the correct password it brings me to choice.html if the pw is wrong then it will bring me to a page(error.html) which will instantly have pop up saying wrong password then redirect me to the login page again.
3. Yay i can log in...but wait!....when i go to the login page again..it doesn't tell me that i'm logged in already !
I also want some indications that i'm already log in like haveing some text which says "You are logged in" in every page i visit. Till i click on logout button!
Edited: I have very limited programming skills..the above code is from my lecturer cause i've just started learning asp.
I have a login system..which basically does:
1. checks for a User name and password in Microsoft Access database.
<!--#include file="adovbs.inc"-->
<!--#include file="msadox.dll"-->
<%
dim con,rs
set con=server.CreateObject("ADODB.Connection")
set rs=server.CreateObject("ADODB.Recordset")
with con
.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("password.mdb")& ";Persist Security Info=false"
.open
end with
with rs
.ActiveConnection=con
.CursorType=adopendynamic
.LockType=adlockoptimistic
.CursorLocation=aduseclient
.Open "Select * from auth"
end with
name1=Request.form("txtname")
pass=Request.form("txtpass")
do while not rs.EOF
if trim(name1)=trim(rs("user")) and trim(pass)=trim(rs("pass")) then
found=true
exit do
end if
rs.moveNext
loop
Response.Clear()
if found then
response.redirect("choice.html")
else
response.redirect("error.html")
end if
%>
2. Now i enter the correct password it brings me to choice.html if the pw is wrong then it will bring me to a page(error.html) which will instantly have pop up saying wrong password then redirect me to the login page again.
3. Yay i can log in...but wait!....when i go to the login page again..it doesn't tell me that i'm logged in already !
I also want some indications that i'm already log in like haveing some text which says "You are logged in" in every page i visit. Till i click on logout button!
Edited: I have very limited programming skills..the above code is from my lecturer cause i've just started learning asp.