jeudi 31 décembre 2015

PHP day and time if/elseif not working

I put together a php to display a certain page based on whether or not we're open. test1.html is when we are open and test2.html is when we are closed. I saved the php as index.php.

When it executes, it only opens the else, which is the test2.html.

Can someone take a look at my code and see what's wrong with it? Thanks!

<?php
 $day = date('N') ;
 $time = date('H:i') ;

 if (($day <= '4') && ($time >= '7:00') && ($time <= '19:30')) 
 {
    echo readfile ("test1.html");
 }
 elseif (($day == '5') && ($time >= '7:00') && ($time <= '18:30')) 
 {
    echo readfile ("test1.html");
 }
 elseif (($day == '6') && ($time >= '7:00') && ($time <= '17:30')) 
 {
    echo readfile ("test1.html");
 }
 else
 {
    echo readfile ("test2.html");
 }
 ?>

Aucun commentaire:

Enregistrer un commentaire