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 2 FirstFirst 12
Results 11 to 15 of 15
  1. #11
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    You're better off having an array with the page names as keys, with their corresponding value as the location. Also in the interest of security, unless you need to use PHP within the "included" file, don't include the page. By including the page you're increasing the chance of having malicious PHP evaluated.

    PHP Code:
    <?php

      $page
    [''] = 'pages/home.htm';
      
    $page['news'] = 'pages/news.htm';
      
    $page['info'] = 'pages/info.htm';

      if(
    file_exists($_tmp=$page[$_GET['page']]))
        print 
    file_get_contents($_tmp);
      else
        print 
    "<strong>The page you requested could not be found.</strong>\r\n";

    ?>

    Quote Originally Posted by :Blobbed View Post
    Use functions:

    PHP Code:
    <?
    function page($url)
    {
    include <<<EOF
    {
    $url}.php
    EOF;
    }
    ?>
    Then:

    PHP Code:
    <?
    include('func.php');
    $url $_GET['page'];
    page($url);
    ?>
    That is a severe risk to your site's security, since anyone could obtain secret information hidden on your server or (if "allow_url_fopen" is enabled in php.ini) even include a malicious PHP page located on their own server. Furthermore, it was pointless splitting it into a function and using heredoc syntax.
    kinda quit.

  2. #12

    Default

    with the switch code, your including files, its best having it as functions with the processed html/php in that.

  3. #13
    Join Date
    Apr 2006
    Location
    West Midlands
    Posts
    3,384
    Tokens
    0

    Latest Awards:

    Default

    Some nice lil codes/tuts forming in this thread!


    Xbox Live: Jholder112233
    PS3 Online Tag: Josh-H

    Last.fm | Digg | Xbox.com

  4. #14
    ScottDiamond Guest

    Default

    Would I put this in my iFrame or remove the iFrame and replace it with that? And renaim it to home.php ?

  5. #15
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by mr.geeza View Post
    Would I put this in my iFrame or remove the iFrame and replace it with that? And renaim it to home.php ?
    You'd replace the Iframe with the PHP code, you shouldn't need to rename anything (as it will be using the files which were being viewed through your Iframe). Be careful about whose script you choose, as some of the scripts posted here aren't secure.
    kinda quit.

Page 2 of 2 FirstFirst 12

Posting Permissions

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