We help IT Professionals succeed at work.

PHP5 Session Handling

swedesamurai asked
Medium Priority
Last Modified: 2012-06-27
Hello Experts,
I have a question about PHP5 Sessions, I have been using some PHP4 Code for a couple of years and suddenly I started getting some funny messages on the bottom of the page.  such as:
Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0.

It seems that my Session handling Code is pretty dated.  After looking for PHP5 Session Management guides on the net I am confused could someone please show me the php5 replacements for my PHP4 session codinge below.  Thanks.
//Server ID:
//session start
// Receiving variables from form
$kdnkdnr = $_POST['kdnkdnr'];
//Register form Variable to session
session_register ("scznrz1");
$HTTP_SESSION_VARS ["scznrz1"] = $sczn1z1;
// Place Session variable id into local variable
$kdnuser = $_SESSION['kdnuser'];

Open in new window

Watch Question

//Register form Variable to session
session_register ("scznrz1");
$_SESSION ["scznrz1"] = $sczn1z1;

// Place Session variable id into local variable
$kdnuser = $_SESSION['kdnuser'];

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Quick and Accurate Thanks
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.