automation script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
murlopaz
Forum Commoner
Posts: 60
Joined: Wed Oct 11, 2006 5:02 pm
Location: Baltimore, MD, USA

automation script

Post 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
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

search the forums for the term cron
and take a look at http://en.wikipedia.org/wiki/Crontab
wyrmmage
Forum Commoner
Posts: 56
Joined: Sat Oct 28, 2006 12:43 pm
Location: boise, ID

Post 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
Post Reply