Results 1 to 5 of 5

Thread: $pages code not redirecting properly..

  1. #1
    Join Date
    Nov 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default $pages code not redirecting properly..

    I do not know PHP... yet! But I am learning.

    This should be simple for all the coders on here.. lol.

    I'm using this code for redirecting to a certain page on specified days of the week, and times:

    Code:
    <?php
    session_start();
    
    //check to see if the date and time is Thursday between 7pm and 9pm
     if (date('H') >= 4 && date('H') <= 5 && date('l') == 'Sunday') {
       $_SESSION['goforit'] = 'yes';
    
      //or you can comment the above and put the chat functions here
     }
    
     else {
      $_SESSION['goforit'] = 'no';
     }
     
     if ($_SESSION['goforit'] == 'yes') { 
    
        header('Location: http://www.arpast.org/chat/cwamod.php'); //redirect to chat page
     }
    
     ?>
    This redirects you to an enter page for my chat room, but only on Thursdays after 7PM and before 9PM.

    Thats working fine.

    But, I want to specify a $page name for the page that it redirects to in an attempt to "hide" the URL of it, or at least mask it. If it isn't hidden, people can just go directly to the entrance page URL... which is not good, because then I have no control over who enters when, rendering the first code completely useless.

    In my attempt, I used the following code directly below the code I posted above:
    Code:
    <?php $pages = Array('chat' => 'http://www.arpast.org/chat/cwamod.php');?>
    This code supposedly will make the url in the address bar look like "http://www.arpast.org/chat/index.php?page=chat" instead of "http://www.arpast.org/chat/cwamod.php".

    But it returned a "This page is not re-directing properly" error.

    I tried it above the first piece of code, and it returned the same error.

    * Do I need to put this code somewhere else?
    * Does this code even work for what I am wanting it to do?!
    * Is it possible to "blend" the two codes to make them work with each other?

    Please help!

    Thanks in advance,
    Suzanne
    Last edited by sweaverit; 11-18-2007 at 09:25 AM.

  2. #2
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Try this:
    PHP Code:
    <?php
    session_start
    ();

    //check to see if the date and time is Thursday between 7pm and 9pm
     
    if (date('H') >= && date('H') <= && date('l') == 'Sunday') {
       
    $_SESSION['goforit'] = 'yes';

      
    //or you can comment the above and put the chat functions here
     
    }

     else {
      
    $_SESSION['goforit'] = 'no';
     }
     
     if (
    $_SESSION['goforit'] == 'yes') { 

        include(
    'chat/cwamod.php'); //includes the chat page.
     
    }

     
    ?>
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  3. #3
    Join Date
    Nov 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Woah, haha.

    Okay that put a view of the entrance page above the regular index page.

  4. #4
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Ok... after the include('chat/.....'); put die();

    Like this:
    PHP Code:
    <?php
    session_start
    ();

    //check to see if the date and time is Thursday between 7pm and 9pm
     
    if (date('H') >= && date('H') <= && date('l') == 'Sunday') {
       
    $_SESSION['goforit'] = 'yes';

      
    //or you can comment the above and put the chat functions here
     
    }

     else {
      
    $_SESSION['goforit'] = 'no';
     }
     
     if (
    $_SESSION['goforit'] == 'yes') { 

        include(
    'chat/cwamod.php'); //includes the chat page.
        
    die();
     }

     
    ?>
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  5. #5
    Join Date
    Nov 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes!! That worked!

    Thank you so much.

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
  •