I recently changed from PHP4 to 5. Yeah, I know, took me long enough. Anyway, its on a shared host and they did the change for me. Unfortunately, the PHP stuff I wrote, doesn’t work anymore. I haven’t done anything with PHP in a long time. I’m curious what may have changed that I need to fix my broken pages.
The pages are relatively simple. They call on a MySQL DB for the content and then put that content on the page after you click a link. Currently, I don’t get any errors, but the page doesn’t change when I click on a link to show the content.
I seem to remember something about needing to declare variables when the new PHP came out and I hadn’t done that so I never bothered to update anything.
Did you do stuff like $name instead of $_GET[‘name’]? And you don’t get any errors probably because the display or which are turned off. Look for an error log in the same location as the file.
Basically, using $name instead of $_GET[‘name’] doesn’t work any more. It was a setting called ‘Register Globals’ - there are many articles about it if you wish to look into it further.
But for a quick overview, register globals automatically put values from the superglobal arrays ($_GET, $_POST etc) into the variable namespace - so rather than $_GET[‘something’], people could just use $something.
However, this means that people can practically insert their own values for your variables in scripts - and for security and integrity reasons, register globals was deprecated and is now fully removed.
So, if you want to get values from the url, use $_GET[‘name’], and $_POST[‘name’] for posted variables.
That did the trick. I went back and reread Kevin’s tutorial about doing PHP and MySQL web sites, where I learned how to do this, and it showed that I needed to add that for my variables. I don’t think it had that back when I read it the first time.