Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Multiple URL Redirect Time based

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #203445
    consultnew
    Participant

    I would like to have a script PHP or JS anything.

    I would like to redirect URL based on time of the day and (not constantly keep reloading in a loop).

    I would like to redirect 3 url, a b and c, depending on time of the day, a.php will load from 6:31 to 14:30, then b.php from 14:31 to 22:30, and c.php from 22:31 to 6:30.

    Maybe if using a invisible iFRAME works, thats also fine i guess.

    Thanks a lot in advance

    #203476
    nkrisc
    Participant

    Interesting. What have you tried so far?

    #203477
    consultnew
    Participant

    I have tried Php script
    I have tried is

    But where it works the prob is it goes in a loop of loading the same URL

    Where it detects the same URL is correct for the particular time of day. It won’t load another URL when the time changes

    Thanks

    #203511
    consultnew
    Participant
    <?php
    $hour = (int)date(“G”);

    if ($hour >= 6 && $hour <= 14)
    {
    ?>
    <script type=”text/javascript”>
    {
    window.location.href = “normal.php”;
    };

    </script>
    <?php
    }

    else if ($hour >= 14 && $hour <= 22)
    {
    ?>
    <script type=”text/javascript”>
    {
    window.location.href = “vodafone.php”;
    };

    </script>
    <?php
    }
    ?>

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.