I have two pages. On one page I am adding an array to $_SESSION. On a second page, I am reading the array (successfully), and then unset that array from $_SESSION.
What happens however is that the second page shows different values than what the first page stored in the session - and that leads me to think that the first page is called again and again, but how can that be if I am on a session and not reloading the page again myself?
What am I doing wrong? Thanks
EDIT: Forgot to mention that the second script is requested by a flash file on the website. The flash file has the session ID as one of its parameters and then sends it to the second script to load the right session (the session_id($_REQUEST['token']); part).
Page 1:
$_SESSION['HEADER_MODEL'] = getModelForHeaderVideo();
/*
[HEADER_MODEL] => Array
(
Yes these are just random numbers (for testing)
[modID] => 303768959
[modUsername] => 347073152
)
*/
Page 2:
<?php
session_id($_REQUEST['token']);
session_start();
header('Content-Type: text/html; charset=utf-8');
if (!isset($_SESSION['HEADER_MODEL']['modID']) || (trim($_SESSION['HEADER_MODEL']['modID']) == '')) {
echo "modID=0";
} else {
echo "&modID={$_SESSION['HEADER_MODEL']['modID']}&modUsername={$_SESSION['HEADER_MODEL']['modUsername']}";
unset($_SESSION['HEADER_MODEL']);
}
?>
session_start()..Why are you starting a new session on page 2?session_iddoes?