1

Session variables are lost after using the following code to redirect:

    header('Location: ./protected_page.php');
    exit; //doesn't seem to do anything

On protected page I make sure to use session_start() before referencing any session variables.

Please help!

1 Answers1

0
  • You redirect to the same domain.If you are redirecting from www.thedomain.com to thedomain.com can possibly end you session

  • Ensure register_globals is off, you can check this on the php.ini file and also using phpinfo().

  • The session variables aren't overwritten.

  • switching between http and https can also end your session.
Lucky
  • 575
  • 3
  • 18
  • After a bit of debugging, the variables are reset immediately after using session_name($session_name). Not sure why. Once that line is commented everything seems to work fine. – Joel de Léséleuc Feb 06 '16 at 17:40