stefangabos / Zebra_Session

A drop-in replacement for PHP's default session handler which stores session data in a MySQL database, providing better performance, better security and protection against session fixation and session hijacking
https://stefangabos.github.io/Zebra_Session/Zebra_Session/Zebra_Session.html
Other
172 stars 85 forks source link

$session->set_flashdata() not working #51

Closed 09173732546 closed 7 months ago

09173732546 commented 7 months ago

Hi, can you confirm if this is not working,

Files:

  1. ini.php with new Zebra_Session($link, $code);
  2. index.php with vardump($_SESSION);
  3. logout.php that will delete sessions and with $session->set_flashdata('myvar', 'myval');

Step:

  1. access /logout.php (cookies and session are deleted via setcookie() and $session-stop() and execute $session->set_flashdata('myvar', 'myval') and redirect to index.php
  2. index php var_dump($_SESSION) does not show myvar variable with or without adding session_start() prior the set_flashdata()

both index and logout have require_once 'ini.php';

stefangabos commented 7 months ago

There is no session after calling $session->stop() so the behaviour is the expected one

09173732546 commented 7 months ago

thanks, i thought i can just use session_start() from logout.php

stefangabos commented 7 months ago

i recommend using regenerate_id instead of stopping the session and everything will then work as you'd expect

09173732546 commented 7 months ago

i recommend using regenerate_id instead of stopping the session and everything will then work as you'd expect

thanks, i will try this instead