FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Regarding Session reset
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Regarding Session reset [message #175045] Fri, 05 August 2011 15:08 Go to next message
Nitin is currently offline  Nitin
Messages: 1
Registered: August 2011
Karma: 0
Junior Member
Hi,

This is Nitin here,I want to reset the session variables as soon
browser got refresh. if any one knows how to do that. please guide me.

Thanks

Nitin
Re: Regarding Session reset [message #175046 is a reply to message #175045] Fri, 05 August 2011 16:01 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Fri, 05 Aug 2011 08:08:47 -0700, Nitin wrote:

> This is Nitin here,I want to reset the session variables as soon browser
> got refresh. if any one knows how to do that. please guide me.

You can't do this reliably.

The best you can do is use session expiry times on the server.

You can *try* and use an onunload event handler in the page to trigger a
call to a url that will reset the session variables, but if the client
computer is disconnected from the network before the page is unloaded it
has no way to handle the event - for example a wifi connected system
where the signal drops and then the user closes the browser.

The only way to catch this is expiring the session on the server after a
predetermined amount of inactivity.

Rgds

Denis McMahon
Re: Regarding Session reset [message #175047 is a reply to message #175046] Fri, 05 August 2011 16:15 Go to previous message
me is currently offline  me
Messages: 192
Registered: September 2010
Karma: 0
Senior Member
On 8/5/2011 12:01 PM, Denis McMahon wrote:
> On Fri, 05 Aug 2011 08:08:47 -0700, Nitin wrote:
>
>> This is Nitin here,I want to reset the session variables as soon browser
>> got refresh. if any one knows how to do that. please guide me.
>
> You can't do this reliably.
>
> The best you can do is use session expiry times on the server.
>
> You can *try* and use an onunload event handler in the page to trigger a
> call to a url that will reset the session variables, but if the client
> computer is disconnected from the network before the page is unloaded it
> has no way to handle the event - for example a wifi connected system
> where the signal drops and then the user closes the browser.
>
> The only way to catch this is expiring the session on the server after a
> predetermined amount of inactivity.


I'm not smart enough to know if this is a good or reliable way to do it.

http://php.net/manual/en/function.session-destroy.php

Search the page for "browser refresh". The contributor offers a function
to do such a thing (at least as I read it).

Bill B
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Using function prototypes in code
Next Topic: Stats comp.lang.php (last 7 days)
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 10:25:14 GMT 2024

Total time taken to generate the page: 0.02354 seconds