Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Session handling with Recess!

I am using Recess Framework for my application & troubled with session handling. I need to store some values in the session.. I am able to create session and session id. But as soon as i navigate to another page, I am not able to retrieve them back !! How to do you people manage your sessions? PHP session handling is simple and straight forward.. but I am simply not able to get this right!

In my home controller I have:

/* !Route GET, / */
function index() {
   .
   .
   session_start();
   $_SESSION['val'] = 'SomeValue';
   .
   .
}

My view displays another form and when user submits, I need to access the session val as well.. so I try to get the value back as:

/* !Route GET, /check */
function check() {
    if(isset($_SESSION['val'])){
       .
       .
       .
    }       
}

But unfortunately, i don't enter the if block .. i am not able to see what my mistake is I tried displaying the session is using session_id() as well and its blank value in check() method.

I also noticed that, all the time I create a new session, the session_id is same!! is it like that in PHP? As far as I read, they should be different!

like image 443
Abdel Raoof Olakara Avatar asked Feb 04 '26 02:02

Abdel Raoof Olakara


1 Answers

After many trails and discussion with other community members at Recess framework's forum, here is how I got it working:

I put the session_start() in recess-conf.php and everything seems to work fine for now!

like image 71
Abdel Raoof Olakara Avatar answered Feb 06 '26 15:02

Abdel Raoof Olakara