Forums

ASP

This topic is locked

check for date expiration

Posted 22 Sep 2002 11:46:29
1
has voted
22 Sep 2002 11:46:29 Tony Trapp posted:
I have a problem that I cannot seem to solve and maybe someone could give a suggestion.

I am working on a site that logs in users with the login user sever be havior for DWMX that works fine, but now they want me to implement check for expiration date.

The reg page has a hiiden field that put in the expiration date by getting todays date + 7 for example.

When the form is filled out and submitted we then have the info we need.

Now for the login page, this is where I am have problems.

The code is the code for login server behavior at the top I crated a variable

<%
' get date that expires for user
Dim yourgone
yourgone =(Now)
%>
then under MM_redirectLoginFailed
I made another MM_redirect and called it MM_redirectExpiredAcct

Then the select statement I added
"SELECT username, password, exper"

after this line
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
I added

If FormatDateTime(yourgone,2) > MM_rsUser("exper" Then 'Users account has expired

I need it to send mail to notify the admin that this user has expired
This uses jmail to send and made it into a .inc file <!--#include file="sendexpiremail.inc" -->

then after mail sent we redirect
Response.Redirect(MM_redirectExpiredAcct)
then we have an else statement and then it goes into the rest of the code placed by DWMX.

The problem is this, it a user has not expired it will not redirect to the page that they are trying to access and second if the users user or password it will not redirect to the failed page and but if the users account does show that the date shows to be expired that works.

So what am I not doing right here or am I puuting this new statement in the wrong place??

If anyone can help that would be great.

Thanks

Replies

Replied 25 Sep 2002 12:17:00
25 Sep 2002 12:17:00 Stuart Harland replied:
You could try a nested condition:


IF username AND password then 'check the uid/pwd before this, if both ok
 If FormatDateTime(yourgone,2) > MM_rsUser("exper" Then 'Users account has expired
   'Do stuff to handle user expiration
   'And redirect...user expired!
  Else
   'this condition handles users who have not expired
   'redirect them - successful login!
  End if
Else 'uid/pwd invalid
  'redirect user to login page & notifiy
  'use of invald uid/pwd - try again
end if

hope this helps!

********************
wheatNOTmeat

Reply to this topic