Results 1 to 5 of 5

Thread: Countdown II Script

  1. #1
    Join Date
    Sep 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Countdown II Script

    http://www.dynamicdrive.com/dynamici...htmlcount2.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...
    Code:
    <?
    $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].
    Last edited by Anenga; 09-08-2004 at 07:39 PM.

  2. #2
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You might need to change

    var todaysec=

    to what you want, rather than what you did.

    Hope this helps
    cr3ative
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  3. #3
    Join Date
    Sep 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by cr3ative
    You might need to change

    var todaysec=

    to what you want, rather than what you did.

    Hope this helps
    cr3ative
    No offense, but that doesn't really sound right...

    I mean, isn't that variable based off the today function? I mean...
    Code:
    	var today=new Date(<? echo $currDate; ?>)
    	var todayy=today.getYear()
    	if (todayy < 1000)
    	todayy+=1900
    	var todaym=today.getMonth()
    	var todayd=today.getDate()
    	var todayh=today.getHours()
    	var todaymin=today.getMinutes()
    	var todaysec=today.getSeconds()
    today.getSeconds = Local seconds of the minute (0-59), why would that make any difference? .......

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Do you have a URL to the problematic page? I'm a little rusty on converting JavaScript dates to GMT, but if the problem is just syntax wise (interface between your PHP variable and the JavaScript itself), I can quickly look over and find the problem.

  5. #5
    Join Date
    Sep 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Emmm

    Well, you'd have to sign up on the forums to be able to access the page etc. Here, perhaps just do this...

    Replace: var today=new Date()

    With: var today=new Date(GMTmilliseconds)

    Replace GMTmilliseconds with, obviously, the current date in GMTmilliseconds. (i.e. 873991800000). Try it out, see if the script works. It doesn't for me, see if u can get it to work.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •