philjm82 Posted August 10, 2010 Share Posted August 10, 2010 Hi there, I have just move hosts with our website and it loads the frontpage but non of the subsequent pages. The site works like this, depending on the variables in the address depends which page and which template are loaded into it. If the template is "ros" it loads rosettes template, if it is "tro" it loads trophy template, and then the name of the item, ie "hazel" will load up the hazel product page. All it is doing at the moment is loading the home.php page. The code to do this is below: <? if (!isset($template)) {include ("static/home.php");} else if (isset($id)) { if (!file_exists("site_templates/$template.php")) { echo "OOPS! <P> The template you have requested does not exist!<BR><BR><BR><BR><BR><BR>"; }elseif (file_exists("site_templates/$template.php")) { include ("site_templates/$template.php"); } } ?> It worked with our last host, but refuses to work now. Is there someone out there that can help. Thanks in advance, Phil Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 10, 2010 Share Posted August 10, 2010 Where are the program variables $template and $id being set at in the code you posted? Quote Link to comment Share on other sites More sharing options...
philjm82 Posted August 10, 2010 Author Share Posted August 10, 2010 They are being set by the links within the page, example /?template=ros&id=hazel&ptitle=hazel Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 10, 2010 Share Posted August 10, 2010 You need to use $_GET['template'], $_GET['id'], ... The code you posted is dependent on register_globals to magically set program variables from the external data in POST, GET, COOKIE,... variables. Unfortunately, register_globals also magically lets hackers set your session variables by simply putting a same name GET parameter on the end of the URL when they request one of your pages. A lot of web sites have been taken over. Register_globals were turned off by default in php4.2 in the year 2002 and I am surprised that we are still seeing php code that has not yet been updated to run with register_globals turned off. Now is the time to update your code because register_globals are scheduled to be completely removed in an upcoming php version. Quote Link to comment Share on other sites More sharing options...
philjm82 Posted August 10, 2010 Author Share Posted August 10, 2010 Thank you very much for your help. I've now got it working with your help. Kindest Regards, Phil Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.