title: php redirect based on time and date
body: <p>I'm trying to have a page redirect to another page based on the time and date. I'm looking to have it switch over on Wednesday between 7pm &amp; 8pm, and then on Sunday from 1030am to 1130am.</p>
  
  <p>I was able to get it to work, although sending it back from the 2nd page to the first is the issue I'm running into.</p>
  
  <p>Here is the code that i'm using</p>
  
  <pre><code>&lt;?php
  $hour = date('G');
  $minute = date('i');
  $day = date('w');
  $m = $hour * 60 + $minute; // Minutes since midnight.
  if(
    $day == 7 // Sunday...
    &amp;&amp; $m &gt;= 615 // ... after 10:15…
    &amp;&amp; $m &lt;= 700 // ... but before 11:40…
  ) header("Location: open.php");
  else if(
  $day == 3 // Wednesday...
    &amp;&amp; $m &gt;= 1125 // ... after 18:45…
    &amp;&amp; $m &lt;= 1235 // ... but before 20:35…
  ) header("Location: open.php");
  </code></pre>
  
  <p>I've tried switching the numbers around, but I either had an error, or it didn't redirect.</p>