Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question url redirect based on time & day of week

    Our site offers streaming audio on Thursday evening (7:30 to 8:30) and on Sunday morning (8:30 to 1:30p). How can I use PHP to direct the visitor to the audio streaming link only during these times. At all other times, I want a message that indicates when the streaming is available.

    Thanks in advance for your suggestions!

    Desi

  • #2
    New Coder
    Join Date
    Jun 2002
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You might try something like this:
    Code:
    <?php 
     $day = date("D");   //returns "Mon" "Tue"
     $time = date("Hi"); //returns HoursMinutes
     if( ($day == "Thu" && $time >= "1930" && $time < "2030") ||
         ($day == "Sun" && $time >= "0830" && $time < "1330") )
     {
      header("Location: REDIRECT URL");
      exit;
     }
    ?>
    That should work, I am not absolutely positive about whether $day will be "Thu" or "Thr" on Thursday, but that should be correct. Hope that this helps.
    ~evlich

  • #3
    New to the CF scene
    Join Date
    Mar 2003
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for your help!

    Desi


  •  

    Posting Permissions

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