I have an application (Developed in DRUPAL -> php)
Here my problem is ,
I want to terminate the session of application as you close the browser.
How to do this?
because PHP sessions work exactly like ordinary cookies!
The server doesn't know which instance is being using.

So I want something like-
When the user returns to the site or if they try to perform any action then effect should be asking user to logged-in.

What should I do on server side?
coz client side solutions will not work for my application
:(

Recommended Answers

All 4 Replies

What should I do on server side?

You cannot detect this server-side only.

apart from server side..
how can I do this?
can you give me solutions to do this?

I've not used this myself, but I think you need to look into JavaScript's unload, onunload, and onbeforeunload events.

ditto evolutionFallen's thoughts, but, javascript is unfortunately unreliable, many browsers block unload scripts
have you considered a timeout on the session

commented: Good caveat +6
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.