Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Session management in Garden

edited September 2009 in Vanilla 2.0 - 2.8
Hi,

I went through the Garden and I found that the Garden has its own session management code. It doesn't uses PHP's built-in session management code. Correct me If I'm wrong.

What is the advantage of that ?

Thanks a lot.

Comments

  • In PHP, to start a session we need to call session_start() function and all session data is stored in the session superglobal array, $_SESSION.

    For example : $_SESSION['name'] = 'value';

    So I would like to know how can we achieve this in Garden?
  • edited September 2009
    $Session = Gdn::Session(); $Session->SetPreference('name', 'value'); // this is persistent $Session->SetAttribute('name', 'value'); // this will last until the next page load (often called flash data)
  • Hey Immersion, thanks a lot.
  • No worries, i don't know it off by heart i just know where to look. If you look in librarys/core/class.session.php i think it is then you can see all the methods for the sessions library.
  • edited September 2009
    Hey Immersion,

    I created a persistent session data in home controller and tried to print it, It works.
    e.g. :
    $Session = Gdn::Session(); $Session->SetPreference('name', 'value'); echo $Session->GetPreference('name');

    But problem is, being authenticated user when i tried to print the same session data in different controller( say settings), I didn't get anything. :(

Sign In or Register to comment.