Countdown then close

Discussion in 'PHP' started by earthgrub1, Oct 29, 2010.

  1. #1
    Hi people this is my first post and im quite new to PHP, what i am trying to do is create a coundown function for 7 days including minutes and seconds in a page then when it reaches 0 i want it to reset its self again but stop users viewing that page but redirect them , would this be possible.

    Many Thanks Chris
     
    earthgrub1, Oct 29, 2010 IP
  2. mikecampbell

    mikecampbell Peon

    Messages:
    26
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Something like this should work.

    $starttime = strtotime('October 29, 2010');
    $currenttime = time();
    $week = 60*60*24*7; // one week in seconds
    if (($currenttime-$starttime)<$week) {
       // show your page
      ...
    } else {
       header('Location: /otherpage.php');
    }
    PHP:
     
    mikecampbell, Oct 29, 2010 IP
  3. earthgrub1

    earthgrub1 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Wow Mike, that looks very impressive will have to look at trying it later today, thankyou for the quick response, may i ask you where you learnt php.

    Regards Chris
     
    earthgrub1, Oct 30, 2010 IP
  4. Pedro Gorrin Diaz

    Pedro Gorrin Diaz Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    www . w3schools . com go to this url there you will find really useful tutorials for jump start :)
     
    Pedro Gorrin Diaz, Oct 31, 2010 IP
  5. mikecampbell

    mikecampbell Peon

    Messages:
    26
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You can learn PHP at http://www.php.net/manual/en/getting-started.php
     
    mikecampbell, Oct 31, 2010 IP
  6. earthgrub1

    earthgrub1 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    thankyou guys you've been a great help
     
    earthgrub1, Nov 6, 2010 IP