Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resetting user access based on expired date field 2

Status
Not open for further replies.

gchaves

Programmer
Oct 27, 2003
105
US
Greetings!

I have a form that keeps track of when a user pays/renews their dues. If their dues are current, their login access is(remains) active. If their dues are not current, then is it possible to have a script kick off, check whether the user's dues are current and, if not, set their login access to inactive until their dues are paid? I would like this to happen automatically so that the adminstrator doesn't have to go through each user one by one. I believe that a server side script is required, but I am not sure how to write one (as I have never had a need to write one before).

I have a dues paid field and a dues renewed field. The dues paid field is manually updated by the administrator. The dues renewed field is automatically set when the form is submitted to 6/30/XXXX and can be overwritten by the administrator as needed. Per client requirements, all dues expire on 6/30 each year.

So, if I paid my dues last on 7/30/2005 and today is 7/1/2006 and my renew by date is 6/30/2006 (and not updated by the administrator to 6/30/2007 because I paid my dues), then my dues are not current.

Where would I need to place this server side script within my page and is there any special syntax that I need to watch out for? Can this even be done automatically? Are there any drawbacks to this, security issues to watch out for, etc.?

Thanks in advance for any help!

G
 
Why not use a single date, the expiration date.

Every time annual dues are paid, 1 year is added to this date.

Service is supsended if today's date is greater than the expiration date... or you could even add a 7 day grace period during which the user is alerted to the impending suspension.
 
What type of database are you using? I would normally run this at the SQL server (assuming you are using one) rather than from an asp page. However, you can certainly do it from an asp page, and as your renewal is the same date for all of your users that makes it easier to implement.

Basically you could create an asp script that would access the database and run a sql command similar to this:

update tbUsers set status ='inactive' where renewed < getdate()

This will update set all users status to inactive if their renewed date is less than the currentdate. The reason I said that I would run this from the SQL server usually is that you could have this be an automated process on the server to run this daily, weekly, or whatever, so if you due dates do not all end on the same day, (you did say the admin could over-ride it) it would make users inactive as their expiration date came up. In asp you do the same thing, but have to run it manually.



 
Thanks for the replies! Both are great suggestions.

I agree that I only need to focus on the renew date. The paid date is basically for the client's needs and I could of (and probably should of) left that out of the equation.

The database in use is only an Access database. The client is not running anything with more power, nor do they need one at this point. That is exactly what I would like to do, though. However, I would like it to be triggered automatically at 12:01 AM on 7/1 each year...without any user intervention. Is that possible? Even using and Access database?
 
You could use the windows task scheduler to execute an UPDATE SQL statement at that particular time.

Be careful that this UPDATE would not overwrite manual changes entered by the administrator.
 
AAARGGHHH!!!!!

I think I may have found a better solution that may not even require a script that is triggered automatically based on the date.

What if I, instead, test to see if the dues are current at the time the user logs in? I will know who the user is, as they will be logging in and the system will be checking for a valid username and password...so why not check at that point to see if the the the renewal date is > or < than the current date? If the current date is less than the renewal date, then dues are current and the user can log in. If the current date is greater than the renew date, then I can redirect the user to a pay dues reminder page at that point.

This is what happens when I overthink things sometimes. Anyone see any holes in this strategy?

G

 
Sounds good. The most reliable machine is the one with the fewest moving parts.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top