Web Hosting Talk







View Full Version : PHP Script does not work after upgrade to PHP5. HELP!


Senad
12-26-2006, 09:28 AM
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.


<?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!

ServerNinja
12-26-2006, 12:49 PM
www.pingpros.com (http://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?

jimpoz
12-26-2006, 01:48 PM
Does this work?
include ("./" . ($page==""?$default:$page) . ".php");

orbitz
12-26-2006, 02:11 PM
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.