John W. Holmes wrote:
>>Hi 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,
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();
}
Gary
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php