A common theme: sessions
| From: | Chesley A Windon | Date: | Wed, 10 Oct 2001 17:35:01 +0000 |
| Subject: | A common theme: sessions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-70713@lists.php.net to get a copy of this message | ||
Hello All:
It seems that there is a common theme on the list with session handling
right now. Unfortunately, this post is no different.
I have a single script that calls itself ($PHPSELF) for authentication
against a MySQL database. I can register session variables and print the
values, but when I reload the page it seems as if the values are lost.
Code Follows.
TIA,
Chesley
<?
/* <snip> */
session_start();
session_register('UserID');
session_register('CID');
session_register('Status');
// Tried this also with no better result
// $HTTP_SESSION_VARS["UserID"]=$row["UserName"];
// $HTTP_SESSION_VARS["CID"]=$row["CustID"];
// $HTTP_SESSION_VARS["StatID"]=$row["StatID"];
$UserID=$row["UserName"];
$CID=$row["CustID"];
$StatID=$row["$Status"];
// This works, so I know there is data in the $row array
echo $row["UserName"];
echo $row["CustID"];
echo $row["StatID"];
header ("Location: $PHPSELF?SID");
/* <snip> */
// After the script calls itself I check for $PHPSESSID then do something.
if ($PHPSESSID) {
session_start();
htmlheader();
// for debug purposes
echo "Testing to make sure the conditional was true...It was.";
// Does not print anything...
while (list($var, $value) = each($HTTP_SESSION_VARS)) {
echo "$var = $value<br>\n";
}
htmlfooter();
}
/* <snip> */
?>