Jump to content

[SOLVED] index.php names


light-angel

Recommended Posts

i have found this script

 

<?Php 

    // Define our array of allowed $_GET values

        $pass = array('main','ts','guides','news','hublist');

            

    // If the page is allowed, include it:

        if (in_array($_GET['page'], $pass)) {

            include ($_SERVER['DOCUMENT_ROOT'] . 'hubs/' . $_GET['page'] . '.php'); 

        } 

        

    // This will load the default page:

        elseif (!isset($_GET['page'])) {

            include ($_SERVER['DOCUMENT_ROOT'] . '/main.php'); 

        }



    // If the page is not allowed, send them to an error page:

        else {

                // This send the 404 header

                    header("HTTP/1.0 404 Not Found");

                // This includes the error page

                    include ($_SERVER['DOCUMENT_ROOT'] . '/error.php');

        }

?>

 

but when i put thin the link like www.mydomain.com/index.php?p=guides

i just keep getting up the main page and the others wont load can some one help me plz

Link to comment
Share on other sites

why don't you just use..

if(!(isset($_GET['page']))){$P='';}else{$P=$_GET['page'];}

if($P=='guides')
{
echo("<META http-equiv='refresh' content='0;URL=http://www.mydomain.com/hubs/guides.php'>");
}

 

you could use a switch statement if you have alot of pages..

 

switch ($P)
{
guides:
  echo ("<META http-equiv='refresh' content='0;URL=http://www.mydomain.com/hubs/guides.php'>");
  break; //Stop leak into next case.
news:
  echo "Number 2";
  break;
ts:
  echo "Number 3";
  break;
main:
  echo "Number 4";
}

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.