Re: [PHP] SESSION values show up days later!

2009-03-28 Thread tedd

At 2:39 PM -0700 3/27/09, Mary Anderson wrote:

Hi all,
   I use session variables to store values from one page to another 
on my website.
   Alas, sometimes, but not always, the values persist from one 
invocation of the script to another!
   Just how, exactly, do I make them go away when a user exits the 
program? I assume my users will not always be logging out explicitly.

   Thanks.
maryfran



maryfran:

I don't know if this will help, but this a "solution" I used once.

// destroy all session data including login -- the user can login 
again to make sure everything is OK


// bye bye cookie
if (isset($_COOKIE[session_name()]))
   {
   setcookie(session_name(), '', time()-42000, '/');
   }

 // and finally
session_destroy();

header("location:http://");
exit();
?>

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] SESSION values show up days later!

2009-03-27 Thread Paul M Foster
On Fri, Mar 27, 2009 at 02:39:22PM -0700, Mary Anderson wrote:

> Hi all,
>I use session variables to store values from one page to another on
> my website.
>Alas, sometimes, but not always, the values persist from one
> invocation of the script to another!
>Just how, exactly, do I make them go away when a user exits the
> program? I assume my users will not always be logging out explicitly.
>Thanks.
> maryfran

Unset the variable. Session variables (as far as I know) will persist as
long as the user keeps open his browser, or until they time out. But you
can do unset($_SESSION['myvar']) to unset a particular variable at any
time (assuming you have previously called session_start()).

Paul

-- 
Paul M. Foster

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



Re: [PHP] SESSION values show up days later!

2009-03-27 Thread Tom Worster
On 3/27/09 5:39 PM, "Mary Anderson"  wrote:

> Hi all,
> I use session variables to store values from one page to another on
> my website.
> Alas, sometimes, but not always, the values persist from one
> invocation of the script to another!
> Just how, exactly, do I make them go away when a user exits the
> program? I assume my users will not always be logging out explicitly.

if this is on a server with low traffic, e.g. a development or test server,
it could be because of the way the garbage collector works. it's explained
in the manual.



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