"Shaun" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > >> function clear_orderinfo() {
> > >>   global $_SESSION;
> > >>   unset($_SESSION["orderinfo"]);
> > >>  }
> > >>
> > >> However this function doesnt seem to work and the session remains
> > >> active, is
> > >> there another way to clear a session?
> >
> > I'm not triffically experienced, but I do have notes on the subject.
> > You're wanting to clear the whole session, right?
> >
> > $_SESSION=array();
> > session_destroy();
> >
> > For specific variables, try assigning FALSE to it
> > ($_SESSION['name']=FALSE; or 'unset' works for versions >=4.2.2.
Otherwise
> > use session_unregister. For me under 4.1.2 I had to set to null.
> >
> > HTH
> > J
> >
> >
>
> Hi,
>
> Thank you for your replies. I am using version 4.3.3 yet unset() doesn't
> seem to work. To test this I have placed this line of code in my
footer.php
> file that appears at the bottom of every page:
>
> echo 'load_orderinfo() = '.load_orderinfo();
>
> Here is the load_orderinfo() function:
>
> function load_orderinfo() {
>   global $_SESSION;
>   if (empty($_SESSION["orderinfo"])) {
>    return false;
>   } else {
>    return $_SESSION["orderinfo"];
>   }
>  }
>
> Before the $_SESSION["orderinfo"] is created the output in the footer
reads:
>
> load_orderinfo() =
>
> When it has been created it reads:
>
> load_orderinfo() = Object;
>
> On the complete_order.php page where I call the clear_orderinfo() function
> it goes back to:
>
> load_orderinfo() =
>
> but it on any subsequent page the output returns to:
>
> load_orderinfo() = Object;
>
> But after calling the clear_orderinfo() function surely the
> $_SESSION["orderinfo"] should have been destroyed. I hope this makes
sense!
>
> Thanks for your help

Hi,

remove the global $_SESSION; lines in your functions - they are uneccessary.
Have you tried resetting $_SESSION instead of unset()?:

$_SESSION = array();

Regards, Torsten Roehr

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to