Saturday, January 13, 2007

PHP changes

I have been using PHP to maintain a couple of web sites for years and I just moved to another web hosting provider and now I am in the middle of changing every one of my PHP scripts. I am using a freeware PHP bulletin board that just stopped working. I check into it and find out that it was assumed every where that a form posting data would set global variables for every form element. For instance, if I have a form element of <input type="text" name="email"> then the function that read that would have a statement of "global $email". I ended up switching all of the globals to use a syntax of $_REQUEST['email'] and now it is all working, well almost. In that same forum code I have a login that is saved to a cookie and that is not working. It used $SCRIPT_URL but that does not work. Who knows how long that will take to figure out? I go to the friend who has never let me down PHP Documentation. The best thing about it is the comments added by users that often has sample code...

1 comment:

Unknown said...

Now that was nasty. It turns out the login problem was the same problem as the form elements not being saved. This time a variable call $UserInfoPass was being used as if it was set as a global. Turns out I had to change it to be $_COOKIE['UserInfoPass']['UserName']. Problem fixed finally!