Results 1 to 6 of 6

Thread: Session Confusion

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Location
    Osaka
    Posts
    200

    Session Confusion

    I have looked into some codes about session management.
    Sequense of session functions are something like that
    Code:
    session_start(); //starts session
    session_unset();//remove all the data from the session
    session_destroy();//remove the session itself
    
    //and then 
    session_register(); //is called
    I am confused about why session_destroy function is called before session_register function.
    Thank You.

  2. #2
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Session Confusion

    Quote Originally Posted by slice
    I am confused about why session_destroy function is called before session_register function.
    Thank You.
    The only reason I can think fo would be to remove any pre-existing sessions or possible ones that may have been injected, those the only reasons I can think of.

    Cheers,

    Ryan Jones
    My Blog.

    Ryan Jones.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Location
    Osaka
    Posts
    200

    Re: Session Confusion

    But it would not nullify session_start() ?

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Session Confusion

    It might, but session_register starts a session automatically if needed.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2006
    Location
    Osaka
    Posts
    200

    Re: Session Confusion

    Quote Originally Posted by CornedBee
    It might, but session_register starts a session automatically if needed.
    Then why coders use session_start() and then session_unset() following session_destroy() before session_register().

  6. #6
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Session Confusion

    Quote Originally Posted by slice
    Then why coder use session_start() and then session_unset() following session_destroy() before session_register().
    Probably for some reason, I still think its to destroy any pre-existing sessions but its not really important to do it that way anyway...

    Cheers,

    Ryan Jones
    My Blog.

    Ryan Jones.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width