By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,795 Members | 1,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,795 IT Pros & Developers. It's quick & easy.

How To check SessionID available or not?

P: n/a
Hi to all,

I am working on a site in which I need to check whether user is online
or not. If user successfully logged out then I can change status from
online to offline but if user do not logged out and close the browser
or session timeout then in both of the case I do not handle how to
change user's status from online to offline.

Please help me to overcome the problem. Looking forward to reply from
all of you.

With Regards & thanks,
Mitul Patel

Feb 27 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Rule #1 - you cannot close a browser window by issuing an instruction from
the server.
Rule #2 - a user does not have to use any logout mechanism that you provide,
he can simply close the browser window.

This means that the user may have finished with your application but your
application still records him as "active".

If you write your session data to a database file you can store the user_id
in each record. Then during the garbage collection on the session table you
can extract the user_id an update that record to "logged_in=FALSE" or
whatever.

--
Tony Marston

http://www.tonymarston.net

"Mitul" <pa***********@gmail.com> wrote in message
news:11**********************@p10g2000cwp.googlegr oups.com...
Hi to all,

I am working on a site in which I need to check whether user is online
or not. If user successfully logged out then I can change status from
online to offline but if user do not logged out and close the browser
or session timeout then in both of the case I do not handle how to
change user's status from online to offline.

Please help me to overcome the problem. Looking forward to reply from
all of you.

With Regards & thanks,
Mitul Patel

Feb 27 '06 #2

P: n/a
Following on from Mitul's message. . .
Hi to all,

I am working on a site in which I need to check whether user is online
or not. If user successfully logged out then I can change status from
online to offline but if user do not logged out and close the browser
or session timeout then in both of the case I do not handle how to
change user's status from online to offline.

Please help me to overcome the problem. Looking forward to reply from
all of you.

With Regards & thanks,
Mitul Patel

You can't, using HTTP, 'ping' the client.
What does that leave?

The client might send a 'heartbeat' using Javascript say once every
couple of minutes.

How could you implement this? Possibly by requesting a url for a frame.
Whatever scheme you use don't expect it to work 100% of the time.
My guess is that you need _instead_ to look /carefully/ at user
authentication.


--
PETER FOX Not the same since the bookshop idea was shelved
pe******@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Feb 27 '06 #3

P: n/a
Mitul wrote:
Hi to all,

I am working on a site in which I need to check whether user is online
or not. If user successfully logged out then I can change status from
online to offline but if user do not logged out and close the browser
or session timeout then in both of the case I do not handle how to
change user's status from online to offline.

Please help me to overcome the problem. Looking forward to reply from
all of you.

With Regards & thanks,
Mitul Patel


Hi.

AFAIK: The onlt way to implement this is by coding your own sessionhandler,
like Mitul wrote.
It is not rocketscience, but you need to study the mechanism a little first.

It boils dow to:
1) You overwite default (filebased) sessionstorage with your own, probably
databasesessionstorage.
How?
start reading here:
http://nl2.php.net/manual/en/functio...ve-handler.php

and surely this:

http://www.zend.com/zend/tut/session.php
2) Now you are in control of the session, you can easily add some extra
functionality to garbagecollection, or sess_open() or wherever you think is
the appropriate place.
Just get the userid out of the session (or store it in the table itself),
and do what you have to do with it, like setting it to not logged in.

Regards,
Erwin Moller
Feb 27 '06 #4

P: n/a
Mitul wrote:
Hi to all,

I am working on a site in which I need to check whether user is online
or not. If user successfully logged out then I can change status from
online to offline but if user do not logged out and close the browser
or session timeout then in both of the case I do not handle how to
change user's status from online to offline.

Please help me to overcome the problem. Looking forward to reply from
all of you.

With Regards & thanks,
Mitul Patel

I would simply just mark them as logged in. but then let their session
time out. For example, if the user has not make any requests in 10
minutes, assume they are dead.

--
Carl Vondrick
www.carlsoft.net
usenet [at] carlsoft [dot] net
Feb 28 '06 #5

P: n/a
This thread also deals with this issue:
http://groups.google.com/group/comp....5b3151c2964750

Feb 28 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.