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 4 FirstFirst 1234 LastLast
Results 11 to 20 of 32
  1. #11
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    In the div you will have your content in, insert the following PHP code:
    PHP Code:
    <?php
       $page 
    $_GET['p'];
       if(!isset(
    $page))
       {
          include(
    "main.php");
       }
       elseif(
    file_exists(""$page ".php"))
       {
          include(
    "" $page ".php");
       }
       else
       {
          print(
    "The page <b>" $page ".php</b> does not exist.");
       }
    ?>
    Create a page called main.php and insert all you default introduction text which will be shown if a page isn't selected.
    You're links will look like:
    Code:
    <a href="index.php?p=about">About</a>
    <a href="index.php?p=news">News</a>
    <a href="index.php?p=staff">Staff</a>
    And so on.
    (Create an .php file for each one though with the content within it).

    For an customized error page you would replace
    PHP Code:
          print("The page <b>" $page ".php</b> does not exist."); 
    with
    PHP Code:
          include("exist.php"); 
    with the exist.php file contained your customized error page to be shown .

  2. #12
    Join Date
    Mar 2007
    Location
    Kent
    Posts
    11,415
    Tokens
    787

    Latest Awards:

    Default

    can it not be /home/news/article5?

  3. #13
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    Quote Originally Posted by today View Post
    can it not be /home/news/article5?
    That's what htacess is for lol .

  4. #14
    Join Date
    Mar 2007
    Location
    Kent
    Posts
    11,415
    Tokens
    787

    Latest Awards:

    Default

    Erm i cant code to save ma life mate lol.

  5. #15
    Join Date
    Jun 2008
    Location
    Doncaster
    Posts
    885
    Tokens
    0

    Default

    Sorry to bump this but Shane, is this targetted?

    /me is noob at PHP.

  6. #16
    Join Date
    May 2008
    Location
    Cheshire
    Posts
    133
    Tokens
    0

    Default

    Shane, yours is a bit insecure isnt it? (not 2 sure though).

    If you wanted to use like /news/article/5

    http://www.workingwith.me.uk/article...ng/mod_rewrite =]

  7. #17
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    Quote Originally Posted by --ss-- View Post
    In the div you will have your content in, insert the following PHP code:
    PHP Code:
    <?php
       $page 
    $_GET['p'];
       if(!isset(
    $page))
       {
          include(
    "main.php");
       }
       elseif(
    file_exists(""$page ".php"))
       {
          include(
    "" $page ".php");
       }
       else
       {
          print(
    "The page <b>" $page ".php</b> does not exist.");
       }
    ?>
    Create a page called main.php and insert all you default introduction text which will be shown if a page isn't selected.
    You're links will look like:
    Code:
    <a href="index.php?p=about">About</a>
    <a href="index.php?p=news">News</a>
    <a href="index.php?p=staff">Staff</a>
    And so on.
    (Create an .php file for each one though with the content within it).

    For an customized error page you would replace
    PHP Code:
          print("The page <b>" $page ".php</b> does not exist."); 
    with
    PHP Code:
          include("exist.php"); 
    with the exist.php file contained your customized error page to be shown .
    Could tidy up the php a bit man lol, i'd use an array to show what pages are allowed to be access etc.

    PHP Code:
    <?php
    $pages 
    = array (     'homepage'     => 'pages/home.php',
                        
    'news'        => 'pages/news.php',
                        
    'god'        => 'pages/godjames.php'
                        
    );

    if ( 
    $pages$_GET'page' ] ] != '' )
    {
        include_once ( 
    $pages$_GET'page' ] ] );
    }
    elseif ( 
    $_GET'page' ] == '' )
    {
        include_once ( 
    $pages'homepage' ] );
    }
    else
    {
        echo ( 
    'Sorry, that page doesn\'t exist' );
    }
    ?>
    haven't really tested it, but its a basic outline etc.
    Hi, names James. I am a web developer.

  8. #18
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    Quote Originally Posted by Arshavin View Post
    Sorry to bump this but Shane, is this targetted?

    /me is noob at PHP.
    What do you mean?
    Quote Originally Posted by Protege View Post
    Could tidy up the php a bit man lol, i'd use an array to show what pages are allowed to be access etc.

    PHP Code:
    <?php
    $pages 
    = array (     'homepage'     => 'pages/home.php',
                        
    'news'        => 'pages/news.php',
                        
    'god'        => 'pages/godjames.php'
                        
    );

    if ( 
    $pages$_GET'page' ] ] != '' )
    {
        include_once ( 
    $pages$_GET'page' ] ] );
    }
    elseif ( 
    $_GET'page' ] == '' )
    {
        include_once ( 
    $pages'homepage' ] );
    }
    else
    {
        echo ( 
    'Sorry, that page doesn\'t exist' );
    }
    ?>
    haven't really tested it, but its a basic outline etc.
    Your way is far more secure and efficient but it's quite annoying having to keep updating everytime you make a new page lol .

  9. #19
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    Better to be safe than sorry though
    Hi, names James. I am a web developer.

  10. #20
    Join Date
    Jun 2008
    Location
    Doncaster
    Posts
    885
    Tokens
    0

    Default

    I'm in agreement about making a new page and is the one you did Shane secure enough?

    I mean as in, you load say about.php inside the main div that you put that code in?

    Would I have to copy index.php again into about.php or just the content and that content will load up in the main div?

    Sorry if I haven't explained very well.

Page 2 of 4 FirstFirst 1234 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
  •