Anenga
09-08-2004, 07:14 PM
http://www.dynamicdrive.com/dynamicindex6/dhtmlcount2.htm
I use this script on a website to tell a user how long until they can download something (I have it where they can become a subscriber and download instantly, otherwise wait 24 hours).
Everything worked great until people started complaining that the script said they could download it, but the script wouldn't let them because their localtime didn't match the server time.
So what I did to fix this was to put...
<?
$now = time(); // GMT Time in seconds since epoc
$currTime = ($now * 1000); // Convert to milliseconds ?>
var today=new Date(<? echo $currTime; ?>)
Unfortunately, customizing the Date function seems to break the countdown script. It prints the time left until you can download etc., but it does not countdown... :( Anyone have any idea how to fix this? I don't know Javascript [well].
I use this script on a website to tell a user how long until they can download something (I have it where they can become a subscriber and download instantly, otherwise wait 24 hours).
Everything worked great until people started complaining that the script said they could download it, but the script wouldn't let them because their localtime didn't match the server time.
So what I did to fix this was to put...
<?
$now = time(); // GMT Time in seconds since epoc
$currTime = ($now * 1000); // Convert to milliseconds ?>
var today=new Date(<? echo $currTime; ?>)
Unfortunately, customizing the Date function seems to break the countdown script. It prints the time left until you can download etc., but it does not countdown... :( Anyone have any idea how to fix this? I don't know Javascript [well].