I made a simple sign up page and when the user's information is validated, right before redirecting, their session id is changed according to a token system I have set up. On the register page, the id is the correct on and I also have a variable UID that I set manually. Although the problem is that on the next page, The id is different, and the variable is undefined.
$_SESSION['UID'] = $id;
session_id($sessID);
session_write_close();
header("Location: /website/landing.php");
exit();
Cookies are enabled, Sessions have a directory "C:/xampp/tmp" and it is written to, I see files with the correct id from the register page there. This is running on localhost and it's an https connection. I've set up everything the way I'm told (through many other stackoverflow answers) it should be , and yet on the next page:
<?php
session_start();
echo session_id()."\n";
echo $_SESSION['UID'];
session_unset();
session_destroy();
?>
<!DOCTYPE html>
<html>
<head>
<title>Logged in</title>
</head>
<body>
<h1>Congratulations, you have successfully logged in!</h1>
<a href="logout.php" title="">Log Out</a>
</body>
</html>
Here when I echo the session id, it's a new one and it stays the same everytime unless I delete it from the Firefox settings, but even then, the new one is also not the user specific one I wanted.
What is the cause of this? I feel like it has something to do with the redirection.