what the heck is wrong with this?

Discussion in 'PHP' started by DrivingTraffic.com, Jun 11, 2009.

  1. #1
    Trying to get redirect once the time is greater than a certain time.

    <?php
    $current_time = date(DATE_RFC822);
    $set_Time1 = 'Thu, 11 Jun 09 12:49:50 -0500';
    $set_Time2 = 'Thu, 11 Jun 09 01:49:50 -0500';
    if ($current_time >= $set_Time1) {
     $link = "http://www.gmail.com";
     } elseif ($current_time >= $set_Time2) {
     $link = "http://www.yahoo.com";
     } else {
     $link = "http://www.google.com"
     }
    header( "HTTP/1.1 301 Moved Permanently" ); //use 301 for permenant redirect
    header( "Location: $link" ); //Change Link Here
    exit();
    ?>
    PHP:
     
    DrivingTraffic.com, Jun 11, 2009 IP
  2. HorseGalleria

    HorseGalleria Peon

    Messages:
    91
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Convert your time to unix time and try it again.
     
    HorseGalleria, Jun 11, 2009 IP
  3. webhed21

    webhed21 Member

    Messages:
    55
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #3
    change first 3 lines to something like this

    $current_time = strtotime(date(DATE_RFC822));
    $set_Time1 = strtotime('Thu, 11 Jun 09 12:49:50 -0500');
    $set_Time2 = strtotime('Thu, 11 Jun 09 01:49:50 -0500');
     
    webhed21, Jun 11, 2009 IP