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 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24

Thread: Error (PHP)

  1. #11
    Join Date
    Nov 2007
    Posts
    1,253
    Tokens
    150

    Latest Awards:

    Default

    Woops yea its meant to be $_GET as $_REQUEST has security holes in as it can get from cookies aswel.

    Edit// Fixed, and don't quote whole posts, it looks a complete mess.


    www.fragme.co = a project.

  2. #12
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    PHP Code:
    if ( isset ( $_GET['page'] ) ) {
        
    $file "content/" $_GET['page'] . ".php";
             if ( 
    file_exists $file ) ) {
                   include ( 
    $file );
             }
             else {
                   include (
    "404.php");
             }
    }
    else {
         echo ( 
    "Epic fail: No GET was set." );

    Thats probs the best way to do it. Simply add all your pages to /content/ then save that as index.php and include files by using; index.php?page=filenamewithoutdotphpontheend
    Lets set the stage on fire, and hollywood will be jealous.

  3. #13
    Join Date
    Nov 2007
    Posts
    1,253
    Tokens
    150

    Latest Awards:

    Default

    I highly disagree with you on that method. Seems like a lazy way and makes your webserver completly unsctructured. Well... in my eyes.


    www.fragme.co = a project.

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

    Latest Awards:

    Default

    Quote Originally Posted by GasFMatt View Post
    I highly disagree with you on that method. Seems like a lazy way and makes your webserver completly unsctructured. Well... in my eyes.
    No its easier instead of having to list every php file on there...

  5. #15
    Join Date
    Nov 2007
    Posts
    1,253
    Tokens
    150

    Latest Awards:

    Default

    Not if your doing it from a database...


    www.fragme.co = a project.

  6. #16
    Join Date
    Dec 2007
    Location
    Toronto, Ontario, Canada
    Posts
    689
    Tokens
    0

    Default

    Thanks Matt, I'm using an edited version of your code. But it's still making my whole page white. Anybody know what's up with that?

    EDIT: Don't worry about that.
    Last edited by loserWILL; 15-07-2008 at 06:58 PM.

  7. #17
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    What is it you're getting?

  8. #18
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by loserWILL View Post
    Thanks Matt, I'm using an edited version of your code. But it's still making my whole page white. Anybody know what's up with that?
    Remove all the exit's
    Lets set the stage on fire, and hollywood will be jealous.

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

    Latest Awards:

    Default

    Quote Originally Posted by GasFMatt View Post
    Not if your doing it from a database...
    Anyone that withdraws from a database always uses a cleaning method, unless they are dumb.

  10. #20
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Highly insecure do NOT use this. You can transverse other directories using this and get files in those directories that you may not want users to see.

    Quote Originally Posted by Tom743 View Post
    PHP Code:
    if ( isset ( $_GET['page'] ) ) {
        
    $file "content/" $_GET['page'] . ".php";
             if ( 
    file_exists $file ) ) {
                   include ( 
    $file );
             }
             else {
                   include (
    "404.php");
             }
    }
    else {
         echo ( 
    "Epic fail: No GET was set." );

    Thats probs the best way to do it. Simply add all your pages to /content/ then save that as index.php and include files by using; index.php?page=filenamewithoutdotphpontheend

Page 2 of 3 FirstFirst 123 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
  •