Declaring Session

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Barkster

    #1

    Declaring Session

    Which one of these is the proper or suggested way to declare session
    variables. I've seen so many different ways but when I use
    session_registe r the pages are way slower.

    1. session_registe r("MM_UserID" );
    $HTTP_SESSION_V ARS['MM_UserID'] = $theID;

    2. session_registe r("MM_UserID" );
    $_SESSION['MM_UserID'] = $loginusername;

    3. $_SESSION['MM_UserID'] = $loginusername;


    Three works best for me and is the fastest but don't know the
    advantages or disadvantages of doing it that way. Option two was
    taking forever.

  • Oli Filth

    #2
    Re: Declaring Session

    Barkster said the following on 02/04/2006 23:29:[color=blue]
    > Which one of these is the proper or suggested way to declare session
    > variables. I've seen so many different ways but when I use
    > session_registe r the pages are way slower.
    >
    > 1. session_registe r("MM_UserID" );
    > $HTTP_SESSION_V ARS['MM_UserID'] = $theID;
    >
    > 2. session_registe r("MM_UserID" );
    > $_SESSION['MM_UserID'] = $loginusername;
    >
    > 3. $_SESSION['MM_UserID'] = $loginusername;
    >[/color]

    If you read the manual (http://php.net/session_register), you would see
    that session_registe r() is deprecated, and has nothing to do with
    $HTTP_SESSION_V ARS or $_SESSION.

    $_SESSION is the way forward!


    --
    Oli

    Comment

    • Barkster

      #3
      Re: Declaring Session

      Thanks, must have missed that in the manual.

      Comment

      Working...