Results 1 to 7 of 7

Thread: redirecting based on time... but it does the WHOLE folder..

  1. #1
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default redirecting based on time... but it does the WHOLE folder..

    I am using this code:

    Code:
    <?php
    if(date("H")<4)
    header("location: /folder/index2.php")
    ?>
    What I am looking for though is basically a one page redirection. Try to explain:

    If user goes to /folder/index.php between 12 and 4 they are auto redirected to /folder/index2.php which is perfect, and this works.

    However, if user goes to /folder/page1.php they are STILL auto redirected to /folder/index2.php

    What I want is to ONLY redirect to /folder/index2.php IF they go to the index, but no redirect if they go to any other page in that folder.

    How can I do this?

    Thanks!
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    What do you mean? Where are you using this code? In index.php? In page1.php?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    The code is on index.php to redirect to index2.php

    but if user goes to page1.php they still get redirected to index2.php I just want the time redirection to happen to index.php to index2.php if they bypass index.php through the URL then I don't want ANY redirection.



    OH FOR CRYING OUT LOUD.... never mind me, I am a dumb ass... I had the stupid redirect code set for 8 instead of 4 AND I had it on ALL the pages in that folder... NO WONDER!!! jeez, sometimes I am amazed I can even breathe.
    Last edited by BLiZZaRD; 12-02-2005 at 11:32 AM.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    I need help with this once again....

    As you can see by the OP this has been up and working for some time.

    I have the code on the index page in a sub folder so structure looks like this:

    http://sub.main.com/folder/subfolder/index.php

    It should be redirecting to:

    http://sub.main.com/folder/subfolder/page1.php IF the user goes to index page between midnight and 8 a.m. (servertime)

    All of a sudden I am getting the "headers already sent" error showing on the page... (still Twey, I know you tried to help with this already through a PM)

    I DO NOT have ANY white space before the <?php and no extra spaces ANYWHERE.

    I have even tried using the ob_start(); flush thing, and even that didn't work

    ANY ideas? I am at wits end here!

    ~BLiZZ
    Last edited by BLiZZaRD; 06-21-2006 at 07:48 AM.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Lil bumpity...
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    An URL?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Eh, sorry for the delay in replying.. However, I did find the problem. There was an error in the virtualhost index .... don't ask... something on the server.

    So my code was right all along. Explains the sudden halt to a working script.

    Either way it is back and working now!! Happy Day!
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

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