Re: $_SESSION
| From: | Paonarong Buachaiyo | Date: | Wed, 16 Oct 2002 08:04:03 +0000 |
| Subject: | Re: $_SESSION | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120131@lists.php.net to get a copy of this message | ||
Please, I' also have some question about $_SESSION.
Simple, how can we earse all $SESSION variable except one or two variables.
Beacuse i want to show some error message in my login form when login
failed. i want to destroy all other $_SESSION variable (about 10) except
$_SESSION['errmsg'] and $_SESSION['errcount'].
Any way to do it except
unset($_SESSION['xx1']);
unset($_SESSION['xx2']);
unset($_SESSION['xx3']);
.
unset($_SESSION['xx10']);
Please,
Pao
"John W. Holmes" <holmes072000@charter.net> wrote in message
news:000501c274a4$ed28ae40$7c02a8c0@coconut...
> > 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.
>
> ---John Holmes...
>
>