Forums
This topic is locked
Is it possible to auto expire user logins?
Posted 17 Jul 2002 07:16:14
1
has voted
17 Jul 2002 07:16:14 sandeep chauhan posted:
I need to give temporary access to users for two weeks. After that period the login should expire automatically.Is this possible using UD and how, if yes? I am developing in ASP with MS access backend.
Sandy
Replies
Replied 17 Jul 2002 07:42:30
17 Jul 2002 07:42:30 aegis kleais replied:
Well. An easy enough way to do that is to have a table like this
tblUsers
fldUserID (id)
fldUsername (text/memo)
fldUserExpires (date)
When you create the user, map the username -> fldUsername box.
Then do something like:
<%
userExpires = Date()
userExpires = DateAdd("d",14,userExpires)
%>
And then insert that value into the fldUserExpires table
On the page, just do something like :
<%
crossCheck = Date()
userExpires = rs.Fields.Item("fldUserExpires"
.Value
if userExpires > crossCheck then
Response.Redirect("user_expired.asp"
end if
%>
Dates are "Larger" if they are later than the current date.
Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])
tblUsers
fldUserID (id)
fldUsername (text/memo)
fldUserExpires (date)
When you create the user, map the username -> fldUsername box.
Then do something like:
<%
userExpires = Date()
userExpires = DateAdd("d",14,userExpires)
%>
And then insert that value into the fldUserExpires table
On the page, just do something like :
<%
crossCheck = Date()
userExpires = rs.Fields.Item("fldUserExpires"
if userExpires > crossCheck then
Response.Redirect("user_expired.asp"
end if
%>
Dates are "Larger" if they are later than the current date.
Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])