Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2003
    Location
    Chicago, IL
    Posts
    722

    PHP Script does not work after upgrade to PHP5. HELP!

    I'm trying to make my site work again like it did before. Basically the index page would use the include function to add content so instead of editing each page when a link change occurred I would just edit the index.php file. Unfortunetly after turning register_globals=off for security reasons and upgrading to php5 (I can't tell what the reason is) my code is not working anymore.

    Code:
    <?php
    
    $default = "welcome";
    
    if($page == ""){$page = $default;} 
    
    include("./$page.php")
    
    ?>
    I have no idea why this is not working anymore as it shouldn't affect the site.

    The current effect is that it is loading the main site if I click on any of the tutorial links instead of loading the content in the middle (The site can be seen at: www.pingpros.com. Thanks for your help!
    Last edited by Senad; 12-26-2006 at 09:41 AM.
    PingPros LLC | International Network Consultant & Internet Service Provider
    Cisco, Juniper, Extreme, BGP, OSPF, Windows, Linux, and Mac Consulting services | Internet Service Provider
    High Quality Services at a very competitive price!

  2. #2
    Join Date
    Dec 2005
    Location
    Internet
    Posts
    1,337
    www.pingpros.com is loading fine and I am able to visit the other pages of the website. Can you please tell us how to duplicate the issue?

  3. #3
    Join Date
    Sep 2004
    Posts
    105
    Does this work?
    PHP Code:
    include ("./" . ($page==""?$default:$page) . ".php"); 

  4. #4
    Join Date
    Mar 2004
    Posts
    1,301
    the problem is your script works if register global is on

    if($page == "") <-- this is the problem

    it should be $_GET['page'] if this is a get method, or $_POST['page'] for post.

Posting Permissions

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