Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts

    Question does the die function destroy the session?

    The scenario is:
    - i start a session
    - if some condition is not fulfilled: die

    But: does the die function destroy the session as well? Or I should do something like:

    if(//condition not fulfilled){
    session_destroy();
    die;
    }

    is this necessary, as a double protection?
    Last edited by Kor; 03-29-2010 at 03:11 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #2
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    die() just ends the script, to destroy the session you need to use session_destroy();

  • Users who have thanked angst for this post:

    Kor (03-29-2010)

  • #3
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    What angst said is true. DIE will stop the script at that point. That's all it does, nothing more. It's used so there isn't forever loops or anything.

    You can unset session variables, or use session_destroy.
    Rowsdower! has accused me of having mental problems, and the administrator allowed it. What a great forum huh?

  • Users who have thanked masterofollies for this post:

    Kor (03-29-2010)

  • #4
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    I'd chuck a session_unset in with the session_destroy for good measure.

  • Users who have thanked MattF for this post:

    Kor (03-29-2010)

  • #5
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Thank you all. I will destroy the session before die
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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