Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   Countdown / Timer Script (http://www.programmingforums.org/showthread.php?t=1150)

nickk Nov 15th, 2004 1:16 PM

Hi,

I'm making a text based online game, and I need to make a timer that does something every 60 min. I have 2 questions:
1) Is it possible to make a countdown that resets after every "run" and restarts
2) To make a PHP script for this, will I need to keep a browser window with this script open on the server 24/7?

Thanks, Nick

Pizentios Nov 15th, 2004 4:16 PM

Depends what you want to do every 60 seconds. If you want to do somthing on the client side of things, you'd probally want to do it with java, since with php you'll have to keep refresing the browser window. However, server side, you might be able to do it with a script in c++ or (if your using linux) a bash script. Doing this in php probally isn't the best way to do it. Can you provide more info on what your trying to do ever 60 seconds?

tempest Nov 15th, 2004 4:19 PM

Youd have to drop a timestamp for each user into a MySQL or into a file and everytime the browser page is refreshed check it against a new timestamp to calc the number of executions of that action you "owe" the user then create a new timestamp to put in its place for the next time.

Ade Nov 15th, 2004 5:07 PM

I made a small PHP prog that did that it work ok but wasnt very practical

tempest Nov 15th, 2004 6:20 PM

Well unless you want to get into C++ then i would suggest that as the best option.


All times are GMT -5. The time now is 1:01 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC