Load Set of Files Between Hrs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nathanwb
    New Member
    • Mar 2008
    • 39

    Load Set of Files Between Hrs

    I have a set of file that I would like to use between the hours of 7am - 9pm, and then another set from 9pm - 7am. Am I on the right track with this code?

    Thanks for any help....


    [php]
    <?php
    $h = date('h');
    if ($h < 09)
    {
    $link1 = 'caddisplay1.ph p';
    $link2 = 'units1.php';
    $link3 = 'emsa1.php';
    }
    else
    {
    $link1 = 'caddisplay.php ';
    $link2 = 'units.php';
    $link3 = 'emsa.php';
    }



    echo "
    <frameset rows=\"32,*\" style=\"border: 0;\" framespacing=\" 0\">
    <frame name=\"toolfram e\" src=\"toolBar1. php\" marginwidth=\"0 \" marginheight=\" 0\" scrolling=\"no\ " frameborder=\"n o\" noresize>

    <frameset id=\"layout\" rows=\"60%,26,* \" cols=\"*\" border=\"3\" framespacing=\" 3\">
    <frame name=\"calls\" src=\"$link1\" scrolling=\"yes \" frameborder=\"y es\">
    <frame name=\"middle\" src=\"$link3\" scrolling=\"no\ " noresize frameborder=\"n o\">
    <frame name=\"units\" src=\"$link2\" scrolling=\"yes \" frameborder=\"y es\">
    </frameset>
    </frameset>
    </frameset>
    </HTML>
    ";
    ?>
    [/php]
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    date('h') gives 12 hour format 01 - 12. You should use date('H') which gives 24 hour format 00 - 23.

    Comment

    • nathanwb
      New Member
      • Mar 2008
      • 39

      #3
      i did have that and i had it set for 21 which is 9p, but it never switched..

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by nathanwb
        i did have that and i had it set for 21 which is 9p, but it never switched..
        You'll need to have the page auto refreshing as well. Remember that script is run once before the page is displayed.

        Comment

        • nathanwb
          New Member
          • Mar 2008
          • 39

          #5
          well I am not worried about the page refreshing, but maily for peopel who chose that link it will pull the correct files after the posted time..

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            Originally posted by nathanwb
            well I am not worried about the page refreshing, but maily for peopel who chose that link it will pull the correct files after the posted time..
            People who click that link will go to the link that was set when the page first loaded. Remember (like I said above) that the PHP file will run only once before the page is displayed.

            Comment

            • nathanwb
              New Member
              • Mar 2008
              • 39

              #7
              I understand that.. but the link to this index file is on a static page elsewhere, once click it will bring you to this page.. that is whay I am referring to..

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                Originally posted by nathanwb
                I understand that.. but the link to this index file is on a static page elsewhere, once click it will bring you to this page.. that is whay I am referring to..
                Declare the $link variables before the if-else part.

                Comment

                Working...