Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 10 of 10

Thread: PHP Includes

  1. #1
    Join Date
    Jul 2005
    Location
    North Wales
    Posts
    4,233
    Tokens
    2,009

    Latest Awards:

    Default PHP Includes

    How do you use them? Because I've tryed and tryed but every time I click the link it goes to the index.php?page=about.php but the included page does not change. Can some one post on how to do it please.

    Thanks,
    Tom.

  2. #2
    Join Date
    Dec 2006
    Posts
    1,128
    Tokens
    0

    Latest Awards:

    Default

    <?php
    include ('somthink.php');
    ?>

  3. #3
    Join Date
    Jul 2005
    Location
    North Wales
    Posts
    4,233
    Tokens
    2,009

    Latest Awards:

    Default

    Quote Originally Posted by MiniEggs View Post
    <?php
    include ('somthink.php');
    ?>
    Yeah I can do that what I mean is I want to beable to change the include, when some one click a button in the nav.
    Last edited by redtom; 22-01-2007 at 05:35 PM.

  4. #4
    Join Date
    Dec 2006
    Location
    Doncaster, UK
    Posts
    4,244
    Tokens
    0

    Latest Awards:

    Default

    A collection of forum users' views on obesity
    Quote Originally Posted by mynameisjake View Post
    sounds good
    Quote Originally Posted by Stephen View Post
    Just google it.
    Quote Originally Posted by jesus View Post
    jesus christ
    Quote Originally Posted by Alexicles. View Post
    It will probably soon go away.

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

    Latest Awards:

    Default

    <?php

    $file = $_GET[page];

    include("$file.php");

    ?>

    Then have as your link: pagecodeison.php?page=home

    Blah, I dont know lol.

  6. #6
    Join Date
    Mar 2006
    Location
    Scotland
    Posts
    1,012
    Tokens
    175

    Latest Awards:

    Default

    Please ignore this post. I have edited it thus no infraction kthnxbi
    Last edited by YouFail; 23-01-2007 at 09:48 AM.


    You don't like me
    Chances are I don't like you.

  7. #7
    Join Date
    Oct 2006
    Posts
    33
    Tokens
    0

    Default

    Quote Originally Posted by Invent View Post
    <?php

    $file = $_GET[page];

    include("$file.php");

    ?>

    Then have as your link: pagecodeison.php?page=home

    Blah, I dont know lol.
    Forgot the ['page'], but yeah, thatl work fine.

  8. #8
    Join Date
    Mar 2006
    Location
    Scotland
    Posts
    1,012
    Tokens
    175

    Latest Awards:

    Default

    Thanks for posting butyou dont need the ['page']. It works fine without it...
    Last edited by YouFail; 23-01-2007 at 12:44 PM.


    You don't like me
    Chances are I don't like you.

  9. #9
    Join Date
    Oct 2006
    Posts
    33
    Tokens
    0

    Default

    Dang, it would seem you are correct. my mistake

  10. #10
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by Invent View Post
    <?php

    $file = $_GET[page];

    include("$file.php");

    ?>

    Then have as your link: pagecodeison.php?page=home

    Blah, I dont know lol.
    Far too insecure, use something like this:

    PHP Code:
    <?php
            $url 
    $_GET["view"];
            
    $site = ("http://url.tld/folder/"); // Write the full url to the folder that the file is in, without the trailing slash ( / )
            
    $rofl str_ireplace("../"""$url); // Replace all ../ with nothing to stop naughty lil hacker wannabe ganster rappers.
            
    if(isset($_GET["view"])) // if ?view=blah is set
            
    {
                if(
    file_exists("$rofl.php")) // if $rofl ($_GET["view"] - ../) exists
                
    {
                    include(
    "$site/$rofl.php"); // Include that file .php!
                
    }
                else 
                { 
    // If it doesn't exist.
                    
    include("404.php"); // Include the 404 page!
                
    }
            }
            else 
    // If it isn't set....
            
    {
                include(
    "welcome.php"); // Include the welcome page
            
    }
            
    ?>
    Last edited by Jewish Bear; 24-01-2007 at 01:33 PM.


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

Posting Permissions

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