So this is how my login process works:
authenticate.php
sessionStart();
if (isset($_SESSION) && !empty($_SESSION['LOCATION'])) {
    $location = $_SESSION['LOCATION'];
    unset($_SESSION['LOCATION']);
} else {
    $location = '//' . $_SERVER['SERVER_NAME'];
}
session_write_close();
sessionStart();
$userIsOnline = isset($_SESSION['ID']);
session_write_close();
sessionStart();
if (!$userIsOnline) {
    // Get the user from the database
    // Validate the user's password
    $_SESSION['ID'] = $user->id;
    $_SESSION['UN'] = $user->un;
    // ... more information
}
session_write_close();
header($location);
exit();
The contents of the sessionStart function:
if (session_id() == '') {
    session_name('MyWebsite');
    session_set_cookie_params(86400, '/', $_SERVER['SERVER_NAME'], true, true);
    session_start();
    $_SESSION['LAST_ACTIVITY'] = time();
    $_SESSION['CREATED'] = time();
}
Then on the top of every page on my website:
sessionStart();
print_r($_SESSION);
$_SESSION['LOCATION'] = $_SERVER['REQUEST_URI'];
session_write_close();
Prints an empty array. So for some reason, it is wiping my session array during the redirect? Anyone have any ideas?
Also, the values of CREATED and LAST_ACTIVITY are from this question.
 
     
    