I am losing data in $ _SESSION when I redirect the header. When I look through this with the debugger, I can see all my data in $ _SESSION before exiting ();
Login.php:
...
if($result == 1){
header("Location: /myaccount.php");
session_write_close();
exit();
} else {
header("Location: /login.php?invalid=yes");
exit();
}
Then I set a breakpoint after the session_start () condition below and $ _SESSION is completely empty.
myaccount.php:
<?php
if(!isset($_SESSION['user_id'])) { session_start(); }
$docRoot = getenv("DOCUMENT_ROOT");
...
Where was my session held?
source
share