I'm writing a login script.. hold the moans.
From the main page one enters a username(email address) and password. which then POST to the login page, housed in a pop up screen, through the target attribute of the form that collects username and password, the login page then authenticates against a mysql database, and displays a good-for-you-remembered-your-password screen. the end of the page sets two session variables
$SESSION['user'] & $SESSION['TableName'] then prints them out because I needed to make sure I had set them when I was debugging. Now if one clicks on the X icon at the top of the screen to leave the login page everything works FINE, if one leaves this little pop up page alone and continues browsing the site things work fine, but if one simply clicks on the javascript enabled button generated above the variables only TableName is retained in the $_SESSIONS array.
When one closes the login page with the window.close() button(not the X at the top) and then tries to access a page that checks for $SESSION['user'] to exist it returns empty. This does NOT happen to the $SESSION['TableName'], and it only seems to happen at all when one closes the window with the widow.close() button.
one comes to the site.
logs in
gets the pop up good job screen ending in
echo "<form onSubmit='window.close()'>";
echo "<input type='submit' Value='Close Window'>";
echo "</form>";
$SESSION['user'] = $HTTP_POST_VARS['User'];
$SESSION['TableName'] =$TableName;
$SESSION['Sacrifice'] ='take one for the team';
reset ($SESSION);
while (list ($key, $val) = each ($_SESSION)) {
echo "$key => $val<br>";
}
which prints all the variables to the screen.
***note this is the first time these variables are set on the site, and yes session_start() is used at the top of the login page.
then one closes the screen with the window.close() button generated above the variables and tries to access a page by clicking on a link on the main page, whose starting code is
<?php
session_start();
echo $SESSION['user'];
echo $SESSION['TableName'];
echo count($SESSION);
reset ($SESSION);
while (list ($key, $val) = each ($_SESSION)) {
echo "$key => $val<br>";
}
and the $_SESSION['user'] variable is EMPTY, even though the other variables, set at the same time on the login page, print out just fine.
I would really appreciate some help here.