Re: Re: A common theme: sessions

From: Date: Thu, 11 Oct 2001 14:51:42 +0000
Subject: Re: Re: A common theme: sessions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-70815@lists.php.net to get a copy of this message
This is probably irrelevant to your question, but is this line correct?
$StatID=$row["$Status"];
Shouldn't that be $Status=$row["StatID"]; Like I said, probably has no bearing on your current problem. -Steve On Thursday, October 11, 2001, at 08:44 AM, Chesley A Windon wrote:
Tried this... by reversing the order of the vars, setting them, then registering them, made no difference. They still did not print. The SID is being set initially. When I tried to read the SID when the page was called a second time (after header()) SID was _not_ set. So I tested for cookies. The page is trying to set a cookie even though I'm trying _not_ to use cookies. Ideas? Thanks, Chesley
ok two things I see, create the vars then register them, not visa versa. $UserID=$row["UserName"]; $CID=$row["CustID"]; $StatID=$row["$Status"]; session_register('UserID'); session_register('CID'); session_register('Status'); second, your not sending the SID as you think you are. header ("Location: $PHPSELF?". SID); even better is make sure SID is accually set, if cookies are being used SID wont be set. $PHPSESSID = session_id(); $SID = "PHPSESSID=$PHPSESSID"; header ("Location: $PHPSELF?$SID"); try that. -- Chris Lee lee@mediawaveonline.com "Chesley A Windon" <windon@orthus.net> wrote in message news:Pine.LNX.4.33.0110101216450.8139-100000@oak.autus.lan...
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> */ ?>
-- Chesley A. Windon windon@theautusgroup.com The Autus Group www.theautusgroup.com 274 South Third Street 614.358.0659 Columbus, OH 43215 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.general (#70815) next »