Page 1 of 1
looking for a continous countdown script using server crons.
Posted: Thu Dec 27, 2007 10:12 pm
by 2DaysAway
I own a game where I use php crons to update game ranks every five minutes and issue turns every ten minutes. These work fine. What happens though when you view a ranks page the time stops. I would like to see the time to continue to run down. I'm wondering if there is a script that could implement this. I'm thinking a javascript using the server crons.
Any ideas or is this a lost cause?
Posted: Fri Dec 28, 2007 3:20 am
by s.dot
Yes, you could feed the current time to a javascript function and let it count down for you. However, as javascript is client side and php (and the cron executing the php scripts) are server side, the javascript countdown would not be dead on accurate. It would only provide an idea of how much time would be left.
Another idea would be an AJAX script to pull the time every (x) seconds. This is a much better idea, as it will be guaranteed to be accurate, since it is pulling data straight from the server. However, since you're running these scripts on cron jobs, you may be concerned about server load? If you're not concerned about server load, go with the AJAX. Otherwise, javascript.