lang2583 Posted November 2, 2006 Share Posted November 2, 2006 I have this simple templating script I've been using for a while on a server w/ PHP4. It was upgraded to PHP5 and won't work any more. Any help?<?phpinclude("header.php");echo "";$id="/home/username/public_html/content/$id.html";if (file_exists($id)) { include($id); } else { include("error.php");};include("footer.php");?> Link to comment https://forums.phpfreaks.com/topic/25984-help-with-simple-script-after-upgrade-from-php4-to-php5/ Share on other sites More sharing options...
JustinK101 Posted November 2, 2006 Share Posted November 2, 2006 Probably register_globals, try enabled it. Link to comment https://forums.phpfreaks.com/topic/25984-help-with-simple-script-after-upgrade-from-php4-to-php5/#findComment-118739 Share on other sites More sharing options...
realjumper Posted November 2, 2006 Share Posted November 2, 2006 I had a similar problem too and my error was using <? instead of <?php. Perhaps this is the case for you too? Check your included files to see Link to comment https://forums.phpfreaks.com/topic/25984-help-with-simple-script-after-upgrade-from-php4-to-php5/#findComment-118740 Share on other sites More sharing options...
trq Posted November 2, 2006 Share Posted November 2, 2006 Don't enable register globals! Try...[code]<?phpinclude("header.php");echo "";$id="/home/username/public_html/content/{$_GET['id']}.html";if (file_exists($id)) { include($id); } else { include("error.php");};include("footer.php");?>[/code]Asuming the initial $id is coming through the url. Link to comment https://forums.phpfreaks.com/topic/25984-help-with-simple-script-after-upgrade-from-php4-to-php5/#findComment-118742 Share on other sites More sharing options...
lang2583 Posted November 2, 2006 Author Share Posted November 2, 2006 [quote author=thorpe link=topic=113657.msg462022#msg462022 date=1162506221]Don't enable register globals! Try...[code]<?phpinclude("header.php");echo "";$id="/home/username/public_html/content/{$_GET['id']}.html";if (file_exists($id)) { include($id); } else { include("error.php");};include("footer.php");?>[/code]Asuming the initial $id is coming through the url.[/quote]Perfect. Many thanks!!! ;D Link to comment https://forums.phpfreaks.com/topic/25984-help-with-simple-script-after-upgrade-from-php4-to-php5/#findComment-118747 Share on other sites More sharing options...
JustinK101 Posted November 2, 2006 Share Posted November 2, 2006 thorpe:Yeah I will admit changing to the proper either $_GET or $_POST is the proper fix, but if he has many, many, other pages he is going to encounter the same error all over the place. So, instead of manually chaning all variables, which is a HUGE pain in the butt, register_globals is the easiet fix, assuming security inst a main concern. Although, I will be the first to admit, if you have time, worth going and changing all your variable to the proper either $_GET and $_POST.Everything I write now, I dont rely on register_globals, but older applications I have written, which do rely on register_globals I am not going to try and fix them. Link to comment https://forums.phpfreaks.com/topic/25984-help-with-simple-script-after-upgrade-from-php4-to-php5/#findComment-118753 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.