dante00
06-02-2004, 02:21 PM
I have a login page , when the user logs the code should checks an expiry date which is stored in a Access DB , and if the account has expired it prompts the user and then redirects the user to another page.
I checked in this forum and i found this code
<code>
if rsDate.fields("ExpiryDate").value < Now() then
response.write "Sorry your account has expired"
response.redirect "expired.htm"
end if
<code>
The problem is that i don't really know how to put it in my code!
the following is my code i called the date column in access ExpiryDate
<code>
<%
filePath = Server.MapPath("member/users.mdb")
Set Con = Server.CreateObject("ADODB.Connection")
Con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&filepath
Set oRs = Con.Execute("select * from users where username='"&request.form("username")&"'")
if oRs.eof then
response.redirect"index1.asp?username="&request.form("username")&"&password="&request.form("password")&"&massage=User or password incorrect! "
else
if oRs.fields("passwd")=request.form("password") then
session("secret")="ok"
session("username")=request.form("username")
if rsDate.fields("ExpiryDate").value < Now() then
response.write "Sorry your account has expired"
response.redirect "expired.htm"
end if
'if request.form("remember")="on" then
' response.cookies("usern")="yes"
'response.cookies("usern").expires =now()+365
'response.cookies("username")=request.form("username")
'response.cookies("username").expires =now()+365
'end if
response.redirect"member/member.asp"
else
response.redirect"index1.asp?username="&request.form("username")&"&password="&request.form("password")&"&massage=Password incorrect! "
end if
end if
Con.close
set Con=nothing
set oRs=nothing
%>
<code>
Can someone please help me with that!!!
Thanks in Advance
Yael
I checked in this forum and i found this code
<code>
if rsDate.fields("ExpiryDate").value < Now() then
response.write "Sorry your account has expired"
response.redirect "expired.htm"
end if
<code>
The problem is that i don't really know how to put it in my code!
the following is my code i called the date column in access ExpiryDate
<code>
<%
filePath = Server.MapPath("member/users.mdb")
Set Con = Server.CreateObject("ADODB.Connection")
Con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&filepath
Set oRs = Con.Execute("select * from users where username='"&request.form("username")&"'")
if oRs.eof then
response.redirect"index1.asp?username="&request.form("username")&"&password="&request.form("password")&"&massage=User or password incorrect! "
else
if oRs.fields("passwd")=request.form("password") then
session("secret")="ok"
session("username")=request.form("username")
if rsDate.fields("ExpiryDate").value < Now() then
response.write "Sorry your account has expired"
response.redirect "expired.htm"
end if
'if request.form("remember")="on" then
' response.cookies("usern")="yes"
'response.cookies("usern").expires =now()+365
'response.cookies("username")=request.form("username")
'response.cookies("username").expires =now()+365
'end if
response.redirect"member/member.asp"
else
response.redirect"index1.asp?username="&request.form("username")&"&password="&request.form("password")&"&massage=Password incorrect! "
end if
end if
Con.close
set Con=nothing
set oRs=nothing
%>
<code>
Can someone please help me with that!!!
Thanks in Advance
Yael