Page 1 of 1

automation script

Posted: Tue Oct 31, 2006 2:49 pm
by murlopaz
Let's say I have a database of user accounts. Each user account has an expiration date.
I need a script that would check every day what user's accounts expire and make those accounts invalid.

The problem is that I am not sure how to automate that script so that it runs every day?

Thanks

Posted: Tue Oct 31, 2006 2:54 pm
by volka
search the forums for the term cron
and take a look at http://en.wikipedia.org/wiki/Crontab

Posted: Tue Oct 31, 2006 8:31 pm
by wyrmmage
yep; crontabs are they way to go......if you don't have access to crontabs, however, there is another way; when a user logs into your site, run a check on the users and make sure that they are not expired, then store the time that you ran the check in a database and put a bit of code into your checking code so that it doesn't run every time a user logs in, just if a user logs in and it has been over 24 hours (or whatever amount of time) sinc eyou last ran the script to see if a user was expired or not.
Hmmmm...not sure if that was very clear or not, sry.
-wyrmmage