I've inherited a clients website and there's some php code on the template thing, that doesn't work properly! I don't really understand it... Can any of you guy help? PHP: <?php if(empty($page)) { header("Location: http://www.website.com/?page=home"); } switch ($page) { case "home": $file = "home.php"; $title = "Home"; break; case "doineed": $file = "doineed.php"; $title = "Do I need an EPC?"; break; case "aboutepcs": $file = "aboutepcs.php"; $title = "About EPC's"; break; case "newbuild": $file = "newbuild.php"; $title = "New-Build"; break; case "energysavingtipsv": $file = "energysavingtips.php"; $title = "Energy Saving Tips"; break; case "aboutus": $file = "aboutus.php"; $title = "About Us"; break; case "test": $file = "404.php"; $title = "Uber-Test"; break; default: $file = "404.php"; $title = "Page Not Found"; } ?> Then there's the navigation which is like this: PHP: <li<?php if($page == "home"){echo ' class="current"'; } ;?>><a href="?page=home">Home</a></li> <li<?php if($page == "doineed"){echo ' class="current"'; } ;?>><a href="?page=doineed">Do I need an EPC? </a></li> (etc...etc...) And this which I can guess links in the content which is in separate files... PHP: <div id="content"> <?php require_once($file); ?> </div>
I'm guessing you have that old (silly) setting in php.ini disabled (as it should be)... I can't remember the name... something like allow_setting_of_any_variable_from_GET_data register_globals*... Anyways, replace PHP: if(empty($page)) { header("Location: http://www.website.com/?page=home"); } with PHP: $page = isset($_GET["page"]) ? $_GET["page"] : "home"; *