Discussion:
Clearing session
Larry Martell
2014-02-26 19:33:17 UTC
Permalink
Is there a way I can clear my session data from the browser? This is
for debugging when I change something. Currently no matter what I do
short of exiting the browser, my session data is always retained. This
makes testing very cumbersome.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Ashley Sheridan
2014-02-26 19:39:52 UTC
Permalink
Post by Larry Martell
Is there a way I can clear my session data from the browser? This is
for debugging when I change something. Currently no matter what I do
short of exiting the browser, my session data is always retained. This
makes testing very cumbersome.
The session data is actually stored on the server, the browser just
sends a session id in the requests it makes to the server so that the
server can access the right data.

You could clear the cookie (or URL parameter if you're using that
method), that contains the session ID, from your browser, or you could
follow the advice at
http://uk3.php.net/manual/en/function.session-destroy.php which explains
in a decent detail exactly how to do what you want.
--
Thanks,
Ash
http://www.ashleysheridan.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Larry Martell
2014-02-26 19:47:21 UTC
Permalink
On Wed, Feb 26, 2014 at 2:39 PM, Ashley Sheridan
Post by Ashley Sheridan
Post by Larry Martell
Is there a way I can clear my session data from the browser? This is
for debugging when I change something. Currently no matter what I do
short of exiting the browser, my session data is always retained. This
makes testing very cumbersome.
The session data is actually stored on the server, the browser just
sends a session id in the requests it makes to the server so that the
server can access the right data.
You could clear the cookie (or URL parameter if you're using that
method), that contains the session ID, from your browser, or you could
follow the advice at
http://uk3.php.net/manual/en/function.session-destroy.php which explains
in a decent detail exactly how to do what you want.
Thanks for the reply, but I am aware of all that and I know about
session_destroy. I want to clear the session from the browser not from
the code.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Ashley Sheridan
2014-02-26 19:49:20 UTC
Permalink
Post by Larry Martell
On Wed, Feb 26, 2014 at 2:39 PM, Ashley Sheridan
Post by Ashley Sheridan
Post by Larry Martell
Is there a way I can clear my session data from the browser? This is
for debugging when I change something. Currently no matter what I do
short of exiting the browser, my session data is always retained. This
makes testing very cumbersome.
The session data is actually stored on the server, the browser just
sends a session id in the requests it makes to the server so that the
server can access the right data.
You could clear the cookie (or URL parameter if you're using that
method), that contains the session ID, from your browser, or you could
follow the advice at
http://uk3.php.net/manual/en/function.session-destroy.php which explains
in a decent detail exactly how to do what you want.
Thanks for the reply, but I am aware of all that and I know about
session_destroy. I want to clear the session from the browser not from
the code.
Did you even look at the link I posted? The second paragraph quite
clearly mentions:

"If a cookie is used to propagate the session id (default behavior),
then the session cookie must be deleted. setcookie() may be used for
that."
--
Thanks,
Ash
http://www.ashleysheridan.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Larry Martell
2014-02-26 19:51:10 UTC
Permalink
On Wed, Feb 26, 2014 at 2:49 PM, Ashley Sheridan
Post by Ashley Sheridan
Post by Larry Martell
On Wed, Feb 26, 2014 at 2:39 PM, Ashley Sheridan
Post by Ashley Sheridan
Post by Larry Martell
Is there a way I can clear my session data from the browser? This is
for debugging when I change something. Currently no matter what I do
short of exiting the browser, my session data is always retained. This
makes testing very cumbersome.
The session data is actually stored on the server, the browser just
sends a session id in the requests it makes to the server so that the
server can access the right data.
You could clear the cookie (or URL parameter if you're using that
method), that contains the session ID, from your browser, or you could
follow the advice at
http://uk3.php.net/manual/en/function.session-destroy.php which explains
in a decent detail exactly how to do what you want.
Thanks for the reply, but I am aware of all that and I know about
session_destroy. I want to clear the session from the browser not from
the code.
Did you even look at the link I posted? The second paragraph quite
"If a cookie is used to propagate the session id (default behavior),
then the session cookie must be deleted. setcookie() may be used for
that."
I had read that page before, but I missed the part about the session cookie.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Aziz Saleh
2014-02-26 19:58:12 UTC
Permalink
Post by Larry Martell
On Wed, Feb 26, 2014 at 2:49 PM, Ashley Sheridan
Post by Ashley Sheridan
Post by Larry Martell
On Wed, Feb 26, 2014 at 2:39 PM, Ashley Sheridan
Post by Ashley Sheridan
Post by Larry Martell
Is there a way I can clear my session data from the browser? This is
for debugging when I change something. Currently no matter what I do
short of exiting the browser, my session data is always retained.
This
Post by Ashley Sheridan
Post by Larry Martell
Post by Ashley Sheridan
Post by Larry Martell
makes testing very cumbersome.
The session data is actually stored on the server, the browser just
sends a session id in the requests it makes to the server so that the
server can access the right data.
You could clear the cookie (or URL parameter if you're using that
method), that contains the session ID, from your browser, or you could
follow the advice at
http://uk3.php.net/manual/en/function.session-destroy.php which
explains
Post by Ashley Sheridan
Post by Larry Martell
Post by Ashley Sheridan
in a decent detail exactly how to do what you want.
Thanks for the reply, but I am aware of all that and I know about
session_destroy. I want to clear the session from the browser not from
the code.
Did you even look at the link I posted? The second paragraph quite
"If a cookie is used to propagate the session id (default behavior),
then the session cookie must be deleted. setcookie() may be used for
that."
I had read that page before, but I missed the part about the session cookie.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Are you using a custom session handler? You shouldn't have to remove the
cookie. session_destroy should destroy the data from the server (it would
still be the same ID, but the data should not be there after the next
load). For the current load, you can do $_SESSION = array().
Cassiano Dal Pizzol
2014-02-26 19:39:59 UTC
Permalink
open a window in "anonymous navigation" in firefox is ctrl+shift+p in
chrome is ctrl+shift+n

in both cases when you close the window all the data is destroyed

-----
Cassiano Dal Pizzol
http://razielbr.blogspot.com/
Post by Larry Martell
Is there a way I can clear my session data from the browser? This is
for debugging when I change something. Currently no matter what I do
short of exiting the browser, my session data is always retained. This
makes testing very cumbersome.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Larry Martell
2014-02-26 19:47:57 UTC
Permalink
On Wed, Feb 26, 2014 at 2:39 PM, Cassiano Dal Pizzol
open a window in "anonymous navigation" in firefox is ctrl+shift+p in chrome
is ctrl+shift+n
in both cases when you close the window all the data is destroyed
Thanks. That is working perfectly for me.
-----
Cassiano Dal Pizzol
http://razielbr.blogspot.com/
Post by Larry Martell
Is there a way I can clear my session data from the browser? This is
for debugging when I change something. Currently no matter what I do
short of exiting the browser, my session data is always retained. This
makes testing very cumbersome.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Domain nikha.org
2014-02-27 19:37:39 UTC
Permalink
Post by Aziz Saleh
Post by Larry Martell
On Wed, Feb 26, 2014 at 2:49 PM, Ashley Sheridan
Post by Ashley Sheridan
Post by Larry Martell
On Wed, Feb 26, 2014 at 2:39 PM, Ashley Sheridan
Post by Ashley Sheridan
Post by Larry Martell
Is there a way I can clear my session data from the browser? This is
for debugging when I change something. Currently no matter what I do
short of exiting the browser, my session data is always retained.
This
Post by Ashley Sheridan
Post by Larry Martell
Post by Ashley Sheridan
Post by Larry Martell
makes testing very cumbersome.
The session data is actually stored on the server, the browser just
sends a session id in the requests it makes to the server so that the
server can access the right data.
You could clear the cookie (or URL parameter if you're using that
method), that contains the session ID, from your browser, or you could
follow the advice at
http://uk3.php.net/manual/en/function.session-destroy.php which
explains
Post by Ashley Sheridan
Post by Larry Martell
Post by Ashley Sheridan
in a decent detail exactly how to do what you want.
Thanks for the reply, but I am aware of all that and I know about
session_destroy. I want to clear the session from the browser not from
the code.
Did you even look at the link I posted? The second paragraph quite
"If a cookie is used to propagate the session id (default behavior),
then the session cookie must be deleted. setcookie() may be used for
that."
I had read that page before, but I missed the part about the session
cookie.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Are you using a custom session handler? You shouldn't have to remove the
cookie. session_destroy should destroy the data from the server (it would
still be the same ID, but the data should not be there after the next
load). For the current load, you can do $_SESSION = array().
Hi Larry, try this:

header("Cache-Control: max-age=0")

should prevent the caching of your page in developping.
If you are finished, set max-age to some decent value.

Chears, Niklaus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Larry Martell
2014-02-27 20:07:44 UTC
Permalink
Post by Domain nikha.org
Post by Aziz Saleh
Post by Larry Martell
On Wed, Feb 26, 2014 at 2:49 PM, Ashley Sheridan
Post by Ashley Sheridan
Post by Larry Martell
On Wed, Feb 26, 2014 at 2:39 PM, Ashley Sheridan
Post by Ashley Sheridan
Post by Larry Martell
Is there a way I can clear my session data from the browser? This is
for debugging when I change something. Currently no matter what I do
short of exiting the browser, my session data is always retained.
This
Post by Ashley Sheridan
Post by Larry Martell
Post by Ashley Sheridan
Post by Larry Martell
makes testing very cumbersome.
The session data is actually stored on the server, the browser just
sends a session id in the requests it makes to the server so that the
server can access the right data.
You could clear the cookie (or URL parameter if you're using that
method), that contains the session ID, from your browser, or you could
follow the advice at
http://uk3.php.net/manual/en/function.session-destroy.php which
explains
Post by Ashley Sheridan
Post by Larry Martell
Post by Ashley Sheridan
in a decent detail exactly how to do what you want.
Thanks for the reply, but I am aware of all that and I know about
session_destroy. I want to clear the session from the browser not from
the code.
Did you even look at the link I posted? The second paragraph quite
"If a cookie is used to propagate the session id (default behavior),
then the session cookie must be deleted. setcookie() may be used for
that."
I had read that page before, but I missed the part about the session
cookie.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Are you using a custom session handler? You shouldn't have to remove the
cookie. session_destroy should destroy the data from the server (it would
still be the same ID, but the data should not be there after the next
load). For the current load, you can do $_SESSION = array().
header("Cache-Control: max-age=0")
should prevent the caching of your page in developping.
If you are finished, set max-age to some decent value.
Thanks for the pointer. For now using the anonymous (or incognito as
chrome calls it) window is working for me.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Carsten Jensen
2014-02-27 22:10:58 UTC
Permalink
Post by Larry Martell
Post by Domain nikha.org
header("Cache-Control: max-age=0")
should prevent the caching of your page in developping.
If you are finished, set max-age to some decent value.
Thanks for the pointer. For now using the anonymous (or incognito as
chrome calls it) window is working for me.
you can also choose to clear the cookies in the browser.
Then you don't need to close the tab you're working on.

in firefox ctrl-shift-del, select (only) cookies and within which
timeframe you want deleted. Chrome probably has something alike.

afair it keeps post data.


/Carsten
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Continue reading on narkive:
Loading...