grlayouts Posted March 16, 2007 Share Posted March 16, 2007 OK i have a site that i want to automate a reset. I want a counter that will go to say 4000 so every 15 mins it will +1 ie. 1/4000 when it gets to 4000 i want it to run a file that resets my site (file i already have created and working) any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/43035-php-countup/ Share on other sites More sharing options...
shaunrigby Posted March 16, 2007 Share Posted March 16, 2007 Possibly set a timestamp in a db table since the last reset, and on user requests, check the time stamp, and if the timestamp is greater than the timestamp, perform a reset, if not then resume.... just a suggestion? Quote Link to comment https://forums.phpfreaks.com/topic/43035-php-countup/#findComment-209009 Share on other sites More sharing options...
per1os Posted March 16, 2007 Share Posted March 16, 2007 Cronjobs would probably be your best bet. Quote Link to comment https://forums.phpfreaks.com/topic/43035-php-countup/#findComment-209017 Share on other sites More sharing options...
grlayouts Posted March 16, 2007 Author Share Posted March 16, 2007 i have cron jobs that help run the counter up. but how do i code a when counter>4000 run reset.php Quote Link to comment https://forums.phpfreaks.com/topic/43035-php-countup/#findComment-209021 Share on other sites More sharing options...
Barand Posted March 16, 2007 Share Posted March 16, 2007 [code] <?php $next_reset = date('Y-m-d H:i:s', strtotime('+1000 hours')); echo "Next reset due at $next_reset"; ?> Set up a cron job to run at that time. (I don't know if you have option of "every 1000 hours") Part of the reset program would be to set the next time for the cron job (this is left as an exercise for the reader ) Or you could write that time to a text file and, if you have a process that runs frequently, get it check if that time has been reached then reset the files and the next_reset_time in the text file.[/code] Quote Link to comment https://forums.phpfreaks.com/topic/43035-php-countup/#findComment-209026 Share on other sites More sharing options...
grlayouts Posted March 16, 2007 Author Share Posted March 16, 2007 so how do i get it to run the reset.php? Quote Link to comment https://forums.phpfreaks.com/topic/43035-php-countup/#findComment-209031 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.