Re: $_SESSION
| From: | Gary | Date: | Wed, 16 Oct 2002 00:44:43 +0000 |
| Subject: | Re: $_SESSION | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120085@lists.php.net to get a copy of this message | ||
John W. Holmes wrote:
The sessions are being set in the browser but when checking for them on each page I am sent to the error page. I notice that when I upgraded to 4.2.3 the sessions are no longer stored in the tmp folder. I check the ini and the folder and path are there. Anything I am missing? Checking code session_start(); if (!isset($_SESSION['SESSION_UNAME'])){ header("Location: error.php?e=2"); exit(); } GaryHi All, still trying to update old code. Am I using $_SESSION properly? <snip> if (mysql_num_rows($res) ==1){ /* If correct start session*/ session_start(); $_SESSION['SESSION_UNAME']; $SESSION_UNAME = $user; header("Location: welcome.php"); mysql_free_result ($res); </snip>Nope. Just use $_SESSION['SESSION_UNAME'] = $user; You can treat $_SESSION just as you would any other array. $_SESSION['something'] = "whatever"; etc... Then, on any page with session_start(), you have the whole session array available to you, no matter what page the variable was initially created on. FYI: use unset($_SESSION['SESSION_UNAME']); to erase a session variable. Thanks Rasmus and John,