I need redirect with time delay, but to show the first website

Discussion in 'PHP' started by josh88, Apr 19, 2009.

  1. #1
    Hi,
    Let's say i own domain1.com, i want all the visitors that will enter this domain, will see the content of the whole site for 1 minute, then, automatically, regardless what content they are browsing in domain1, they will be redirected to domain2.com,

    how can i do that?

    appreciate if someone can help

    Thank you
     
    josh88, Apr 19, 2009 IP
  2. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #2
    session_start();
    if (!isset($_SESSION['minute']) {
    $_SESSION['minute'] = time();
    } else {
         $delay = time() - $_SESSION['minute'];
         if ($delay >= 60) {
              header("Location: http://www.yournewdomain.com");
         }
    }
    PHP:
     
    ActiveFrost, Apr 19, 2009 IP
  3. dannywwww

    dannywwww Well-Known Member

    Messages:
    804
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    110
    #3
    
    <?php
    header('Refresh: 60;url=http://www.domain2.com');
    ?>
    
    PHP:
    Edit: just realized not what you wanted, id go with the above example.
     
    dannywwww, Apr 19, 2009 IP
  4. ActiveFrost

    ActiveFrost Notable Member

    Messages:
    2,072
    Likes Received:
    63
    Best Answers:
    3
    Trophy Points:
    245
    #4
    And what if he'll click on another link in his page ( let's say, another article ) ? It'll start to countdown from 0 again and again .. :rolleyes:
     
    ActiveFrost, Apr 19, 2009 IP