session active?
Moderator: General Moderators
session active?
How can I find out if a certain SESSID is active?
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
yes, I want to know if the user is still requesting pages and did not close the browser without logging out...
I've found out that the sessions are staying on the server for a while, even without variables, so when I check if the session exists, I allways get 'yes'. thus I want to know if a session is active, not if it exists...
I've found out that the sessions are staying on the server for a while, even without variables, so when I check if the session exists, I allways get 'yes'. thus I want to know if a session is active, not if it exists...
I don't understand either how this session in php works. It starts off well but when destroying,unregistering,unsetting etc the $PHPSESSID still remains.
I still am not sure if its a bug or our mistake. But again how are others making it work ?
You may find some useful info here :
http://www.experts-exchange.com/Web/Web ... 35728.html
I still am not sure if its a bug or our mistake. But again how are others making it work ?
You may find some useful info here :
http://www.experts-exchange.com/Web/Web ... 35728.html
Code: Select all
<?php
if (isset($PHPSESSID))
print("Session active");
else
print("Not Active !")
?>-
TheBentinel.com
- Forum Contributor
- Posts: 282
- Joined: Wed Mar 10, 2004 1:52 pm
- Location: Columbus, Ohio
Do the sessions eventually time out? 20 minutes or something? If not, is that a setting?Vantuykom wrote:but when somebody has another session open then it does not work
"Active" is sort of a misnomer in a web environment. I can connect to your site, then shut off my computer. No "I'm disconnecting" messages got passed back to you. So from the server's perspective, am I active or not? How would it know?
There is a setting called keep-alive, I think it's a header. But I don't know what it means exactly. If it involves the server pinging the client to make sure it's still there, or the client pinging the server to let it know it's still there, then you'd have to balance that resource cost against the resource cost of keeping sessions around you don't need until they time out.
Another question might be, do you NEED to use sessions? If it's a problem to keep them open, you could just handle your state-saving chores in another way. Hidden fields, query strings, that sort of thing.