PHP5 Session Handling

Posted on 2009-02-09
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

Question by:swedesamurai
    LVL 28

    Accepted Solution

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

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


    Author Closing Comment

    Quick and Accurate Thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now