Countdown in real time...

Discussion in 'PHP' started by tru504187211, Aug 17, 2006.

  1. #1
    Is there a way to have the php code count down real-time seconds? So say I want it to count from 60 seconds...is there a way to tell it count 60 seconds down to zero, using real time? ...not depedant on the server's time hopefully...

    Thanks!
     
    tru504187211, Aug 17, 2006 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    No. PHP is client side and once parsed you can't do anything anymore. It's static in that regard. You'll need something client side like JavaScript.
     
    T0PS3O, Aug 17, 2006 IP
  3. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Typo :)
    extra text.
     
    exam, Aug 17, 2006 IP
  4. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #4
    but you can use Javascript and it's settimeout function as a clientside "looper" to display a countdown. (see the javascript portion of the forum here)

    you can even integrate what the javascript counts down from by modifying the javascript variables with PHP :)
     
    ccoonen, Aug 17, 2006 IP
  5. surefire

    surefire Guest

    Messages:
    40
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Or you could do it in Flash. Easier to control the look of the timer.

    PHP could also be used to set a cookie and trigger the timer's start relative to the last time the visitor was cookied on your site.
     
    surefire, Aug 18, 2006 IP
  6. tru504187211

    tru504187211 Peon

    Messages:
    287
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I'll let you guys tell me which method is best...

    Basically, I found open source php code that pings a website of my choice one time and returns the result to the php page for displaying it. I then added a function that if the site returns a value of 'offline', it will send a smtp message to my sprint phone. I would like this to be able to run either as a timed function, such as hourly, or as a service...hourly...

    How do you guys think I should go about doing this? Or do I need to go at it a different approach?

    Thanks!
     
    tru504187211, Aug 18, 2006 IP