ale_jrb Posted May 27, 2006 Share Posted May 27, 2006 Hi.I need to code a timer but I am unsure how I should go about doing so. It needs to work in such a way that a user can click a link which will start a timer. The timer will then start counting down. It must be able to change without the user having to refresh the page. Also, the user must be able to close the page or destroy their log in section and it must carry on counting. When it reaches the end it activates something.Does anyone know how I could manage this? Thanks very much!:) Quote Link to comment https://forums.phpfreaks.com/topic/10596-visible-countdown/ Share on other sites More sharing options...
.josh Posted May 27, 2006 Share Posted May 27, 2006 well if you have a timestamp column and a timelength column in a database, when the user clicks on start, it can send the current timestamp to the database, as well as the length of time you want the timer to be. then you would have a script that gets the information from the database. then you would use ajax and javascript to continually call the script and retrieve the information and display it.if the user closes the browser.. well the timestamp is in the database, along with the length. if the user goes to the countdown page, it will continue to pull the original timestamp and timelength from the database and show the countdown accordingly. all the while, the script would check to see if the current time stamp is greater than the original timestamp + the timelength. if it is, then do the event. Quote Link to comment https://forums.phpfreaks.com/topic/10596-visible-countdown/#findComment-39528 Share on other sites More sharing options...
ale_jrb Posted May 28, 2006 Author Share Posted May 28, 2006 Ooh... OK, thanks. Now to find out how to call a script with Javascript... :)Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/10596-visible-countdown/#findComment-39667 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.