Gates, Jeff wrote: > I need to update my php code on an old site as my host is now using PHP > 5.4.30 and my old code is using session_register which is has been removed > from this version of PHP. I am a newbie so I hope you'll bear with me. > > First: the errors I'm getting: > > [11-Sep-2014 11:21:14 America/Denver] PHP Notice: Undefined variable: > PHPSESSID in /home7/outtacon/public_html/dichotomy/intro.php on line 12 > [11-Sep-2014 11:21:14 America/Denver] PHP Fatal error: Call to undefined > function session_register() in > /home7/outtacon/public_html/dichotomy/intro.php on line 14 > > > > > Second, here the code for lines 12 to 14: > > ####phpinfo(); > if (!$PHPSESSID) { > ##register variables > session_register("as_role"); > session_register("as_name"); > session_register("as_email"); > session_register("as_reenteremail"); > session_register("as_story"); > ##print("setting up session"); > } else if ((!$as_role) || (!$as_name) || (!$as_email) || > (!$as_reenteremail) || (!$as_story)) { > session_register("as_role"); > session_register("as_name"); > session_register("as_email"); > session_register("as_reenteremail"); > session_register("as_story"); > ##print("setting up session 2"); > } > > > > I am also getting some errors on other pages but they are similar. It's > the session_register. > > Is there a way to substitute session_register for something else easily? > (Wishful thinking.) Apparently, the code that you have posted relies on register_globals=On (the use of $PHPSESSID suggests so). However, this "feature" has also been removed as of PHP 5.4, so simply substituting session_register() with something else (what might be possible; see the description and comments on <http://php.net/manual/de/function.session-register.php>) won't really solve all issues. Actually, facing such code smells, a full code review seems to be more than appropriate (code that is relying on register_globals=On is likely to have more issues). If you don't feel up to that task and you need the script for any production purpose, you should consider hiring an experienced developer or to replace the script with a contemporary one. Perhaps you better ask whether somebody can recommend a script that does XYZ (and which one!), instead of asking how to fix the old script. -- Christoph M. Becker -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php