Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Location
    Corby
    Posts
    5,512
    Tokens
    2,675
    Habbo
    cabbage (origins)

    Latest Awards:

    Default just a quick one [php]

    So Ive got this code on my index.php page
    PHP Code:
    <?php

    if($_GET['page']) {
    $page $_GET['page'];
    $page str_replace("."""$page);
    $page "".$page.".php";

    if(
    file_exists($page)) {
    include(
    "$page");
    } else {
    include(
    "404.php");
    }
    }
    else {
    include(
    "home.php");
    }

    ?>
    and I have no idea what format the link would be.. i.e "blahblah.php?lolol" or something? any help +rep
    no

  2. #2
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Ha :p

    That's my old include script that I wrote ^______^

    Do, file.php?page=yourpage


  3. #3
    Join Date
    Oct 2005
    Location
    Corby
    Posts
    5,512
    Tokens
    2,675
    Habbo
    cabbage (origins)

    Latest Awards:

    Default

    yep it is
    and thanks
    (needa spread repz)
    no

  4. #4
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    PHP Code:
    <?php

    $get_req 
    "page"/* Change this to what you want to use to control the page. (If you choose "page" then you'd to yourfile.php?page=index */
    $home_file "home.php"/* Change this to your home file so that it loads if no other file is specified (There is no ?var=) */
    $error_file "404.php"/* Change this to your 404 File not found page which loads if the file specified doesn't exist */

    if( $_GET$get_req ] )
    {

        
    $page $_GET$get_req ];
        
        
    $filter = array("http://"".");
        
        
    $page str_replace$filter ""$page);
        
        
    $page $page.".php";
        
        if( 
    file_exists$page ) )
        {
        
            include(
    $page);
            
        }
        else
        {
        
            include( 
    $error_file );
        
        }
    }
    else
    {
        
        include( 
    $home_file );
        
    }

    ?>
    Is a better code by the way
    Last edited by Invent; 30-09-2007 at 03:44 PM.

Posting Permissions

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