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!


Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: [PHP] Includes.

  1. #1
    Join Date
    Oct 2006
    Location
    Merseyside
    Posts
    2,335
    Tokens
    0

    Latest Awards:

    Default [PHP] Includes.

    Hey,

    I have just done a website with php includes so far so good but 1 problem.

    PHP Code:
    ?page=comments?id=$b[id
    That link wont work. I know its the ?id=$b[id] but how could I go about fixing it?

    Thanks

  2. #2
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by !Lily View Post
    Hey,

    I have just done a website with php includes so far so good but 1 problem.

    PHP Code:
    ?page=comments?id=$b[id
    That link wont work. I know its the ?id=$b[id] but how could I go about fixing it?

    Thanks
    change

    PHP Code:
    ?page=comments?id=$b[id
    to

    PHP Code:
    ?page=comments&id=$b[id
    Looking for a good desiner to design a social networking template.

    PM me.

  3. #3
    Join Date
    Oct 2006
    Location
    Merseyside
    Posts
    2,335
    Tokens
    0

    Latest Awards:

    Default

    Thanks +Rep

  4. #4
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    No problem im here to help.

    Well sort of... ;l
    Looking for a good desiner to design a social networking template.

    PM me.

  5. #5
    Join Date
    Dec 2006
    Location
    Swindon
    Posts
    3,299
    Tokens
    215
    Habbo
    dunko

    Latest Awards:

    Default

    And you can just keep adding aswell

    ?view=hello&me=is&not=gay&so=lets&go=to&bed=please

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

    Latest Awards:

    Default

    Make sure the includes script has protection, this is a good example of a secure including script:

    PHP Code:
    <?php

    if( isset ( $_GET"page" ] ) && !empty( $_GET"page" ] )) {
        
        
    $page $_GET"page" ];
        
    $page str_replace"."""$page);
        
    $page urlencode$page );
        
    $page htmlentities$page );
        
    $page ""$page .".php";

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

    ?>
    Last edited by Invent; 19-06-2007 at 07:00 PM.

  7. #7
    Join Date
    Oct 2006
    Location
    Merseyside
    Posts
    2,335
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Invent View Post
    Make sure the includes script has protection, this is a good example of a secure including script:

    PHP Code:
    <?php

    if( isset ( $_GET"page" ] ) && !empty( $_GET"page" ] )) {
        
        
    $page $_GET"page" ];
        
    $page str_replace"."""$page);
        
    $page urlencode$page );
        
    $page htmlentities$page );
        
    $page ""$page .".php";

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

    ?>
    Yer thanks ive already got that

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

    Latest Awards:

    Default

    :p I got bored, so I decided to make it lol.

  9. #9
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    Quote Originally Posted by Invent View Post
    Make sure the includes script has protection, this is a good example of a secure including script:

    PHP Code:
    <?php

    if( isset ( $_GET"page" ] ) && !empty( $_GET"page" ] )) {
        
        
    $page $_GET"page" ];
        
    $page str_replace"."""$page);
        
    $page urlencode$page );
        
    $page htmlentities$page );
        
    $page ""$page .".php";

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

    ?>
    A good alternative i find is just to keep the files in a dir and hardcode it to the script which prevents any misuse

    PHP Code:
    $page $_GET"page" ];
    $location "pagesfolder/".$page.".php"
        if( 
    file_exists($location) ) {
            include(
    $location);
        }else {
             include( 
    "defultpage.php" );
        } 
    put what u like in the url, pagesfolder/http://haxzorsite.hax/l33t.php.php aint gona be found.

    ps. -removed- i was wrong, im to use to js escapting
    Last edited by Mentor; 19-06-2007 at 07:11 PM.

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

    Latest Awards:

    Default

    Yes, but I thought incase for some odd reason they may want to protect files from another folder being accessed.

    Because with your script the user could do ?page=../../page.php

    Not sure why you need to block it but yeah

Page 1 of 2 12 LastLast

Posting Permissions

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