![]() |
PHP Countdown Items Remaining Code?? I'm looking for a script that will display a number and drop it down 1 by 1 until its down to 1, for the purpose of simulating the number of available items remaining. It would be more realistic if the number didn't countdown at a consistent interval, but was a bit random. I've done a lot of searching, but all I could find was countdowns to dates. Does anyone have a script for this that they would be willing to share? Thanks. |
Re: PHP Countdown Items Remaining Code?? Do you want it to count down while the person is looking at the page (ie they see it going down)? If so, javascript may be a better option than PHP. |
Re: PHP Countdown Items Remaining Code?? Countdown on page refresh? Or countdown without page reload? |
Re: PHP Countdown Items Remaining Code?? Without page reload. |
Re: PHP Countdown Items Remaining Code?? What I would do... Run a program that randomly selects a number from 1 to 5 every x seconds. If it picked 1, then drop the quantity, otherwise, keep it the same. That way it would change in a truly random way. Now, if you do this in straight-up javascript (which is required to see the changes in "real-time") there is the problem that your sham of an inventory would be revealed if a person peeks at the page source code. (all the javascript would be exposed) If you want to be more discrete you would need to run the random function via AJAX so the processing is done "secretly" with PHP or something. -Ryan |
Re: PHP Countdown Items Remaining Code?? It's funny cause I was thinking the same thing. Guess its a pretty basic script. I'm not too worried about people peeking. If anything I'd be more worried about someone hitting refresh and seeing it jump right back to the initial inventory count, but its PPV so whatever. |
Re: PHP Countdown Items Remaining Code?? You could use sessions to maintain consistency between page refreshes. It is very simple stuff - you could also use AJAX which would completely avoid people from peeking. However, I do think that's a little paranoid ;) |
| All times are GMT -6. The time now is 09:09 AM. |