User status Online/Offline?

This is a discussion on User status Online/Offline? within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I want to know how to check that user is online or offline by Php.If he visit pages then ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-19-2007
Php Developer
 
Posts: n/a
Default User status Online/Offline?

I want to know how to check that user is online or offline by Php.If
he visit pages then he is online, if he not accessed page he is
offline. How to handle this is in PHP...I set session of each user...
Reply With Quote
  #2 (permalink)  
Old 12-19-2007
Michael Fesser
 
Posts: n/a
Default Re: User status Online/Offline?

..oO(Php Developer)

>I want to know how to check that user is online or offline by Php.If
>he visit pages then he is online, if he not accessed page he is
>offline.


He's "online" while the script is running, after that he's "offline"
until the next request. That's simply how HTTP works.

Micha
Reply With Quote
  #3 (permalink)  
Old 12-19-2007
Olaf Schinkel
 
Posts: n/a
Default Re: User status Online/Offline?

Php Developer schrieb:
> I want to know how to check that user is online or offline by Php.If
> he visit pages then he is online, if he not accessed page he is
> offline. How to handle this is in PHP...I set session of each user...

That is *not* possible.
PHP genarates the code, sends it to the Client and FINISH.
So you have to do something on the website.
Maybe an AJAX request every x Seconds.
But when the client has no JS, or disabled it....
.... it doesn“t work too.
And when JS is working an the person at the computer is sleeping?


Result:
Forget it.


Olaf

Reply With Quote
  #4 (permalink)  
Old 12-19-2007
macca
 
Posts: n/a
Default Re: User status Online/Offline?

Facebook shows who's online by identifying which members have been
active in the last five minutes.

how? I'm not sure? maybe some kind of authentication and reading the
apache access log? maybe some kind of database table?
Reply With Quote
  #5 (permalink)  
Old 12-19-2007
Michael Fesser
 
Posts: n/a
Default Re: User status Online/Offline?

..oO(macca)

>Facebook shows who's online by identifying which members have been
>active in the last five minutes.
>
>how? I'm not sure? maybe some kind of authentication and reading the
>apache access log? maybe some kind of database table?


You just have to keep track of active sessions. One way to do this in
PHP is to use your own session handler, which stores the session data
and a timestamp in a DB table (or just the timestamp in the DB and the
session data in flat files, whatever you like). Then you just have to
fetch all records that were updated in the past 5 minutes or something
like that.

But even this is just a wild guess and never really accurate. As said,
HTTP doesn't allow for accuracy here:

* user sends request
* user gets answer
* user is gone

It's always the same.

Micha
Reply With Quote
  #6 (permalink)  
Old 12-19-2007
Onideus Mad Hatter
 
Posts: n/a
Default Re: User status Online/Offline?

On Wed, 19 Dec 2007 19:23:31 +0100, Michael Fesser <netizen@gmx.de>
wrote:

>.oO(macca)
>
>>Facebook shows who's online by identifying which members have been
>>active in the last five minutes.
>>
>>how? I'm not sure? maybe some kind of authentication and reading the
>>apache access log? maybe some kind of database table?

>
>You just have to keep track of active sessions. One way to do this in
>PHP is to use your own session handler, which stores the session data
>and a timestamp in a DB table (or just the timestamp in the DB and the
>session data in flat files, whatever you like). Then you just have to
>fetch all records that were updated in the past 5 minutes or something
>like that.
>
>But even this is just a wild guess and never really accurate. As said,
>HTTP doesn't allow for accuracy here:
>
>* user sends request
>* user gets answer
>* user is gone
>
>It's always the same.
>
>Micha


There are ways of doing it with Java or Flash 9...on the same level of
accuracy you would get with an IRC channel...but that still includes
people who visit a site, leave it on and then go to the grocery store
or whatever.

--

Onideus Mad Hatter
mhm ¹ x ¹
http://www.backwater-productions.net
http://www.backwater-productions.net/hatter-blog


Hatter Quotes
-------------
"You're only one of the best if you're striving to become one of the
best."

"I didn't make reality, Sunshine, I just verbally bitch slapped you
with it."

"I'm not a professional, I'm an artist."

"Your Usenet blinders are my best friend."

"Usenet Filters - Learn to shut yourself the fuck up!"

"Drugs killed Jesus you know...oh wait, no, that was the Jews, my
bad."

"There are clingy things in the grass...burrs 'n such...mmmm..."

"The more I learn the more I'm killing my idols."

"Is it wrong to incur and then use the hate ridden, vengeful stupidity
of complete strangers in random Usenet froups to further my art?"

"Freedom is only a concept, like race it's merely a social construct
that doesn't really exist outside of your ability to convince others
of its relevancy."

"Next time slow up a lil, then maybe you won't jump the gun and start
creamin yer panties before it's time to pop the champagne proper."

"Reality is directly proportionate to how creative you are."

"People are pretty fucking high on themselves if they think that
they're just born with a soul. *snicker*...yeah, like they're just
givin em out for free."

"Quible, quible said the Hare. Quite a lot of quibling...everywhere.
So the Hare took a long stare and decided at best, to leave the rest,
to their merry little mess."

"There's a difference between 'bad' and 'so earth shatteringly
horrible it makes the angels scream in terror as they violently rip
their heads off, their blood spraying into the faces of a thousand
sweet innocent horrified children, who will forever have the terrible
images burned into their tiny little minds'."

"How sad that you're such a poor judge of style that you can't even
properly gauge the artistic worth of your own efforts."

"Those who record history are those who control history."

"I am the living embodiment of hell itself in all its tormentive rage,
endless suffering, unfathomable pain and unending horror...but you
don't get sent to me...I come for you."

"Ideally in a fight I'd want a BGM-109A with a W80 250 kiloton
tactical thermonuclear fusion based war head."

"Tell me, would you describe yourself more as a process or a
function?"

"Apparently this group has got the market cornered on stupid.
Intelligence is down 137 points across the board and the forecast
indicates an increase in Webtv users."

"Is my .sig delimiter broken? Really? You're sure? Awww,
gee...that's too bad...for YOU!" `, )
Reply With Quote
  #7 (permalink)  
Old 12-19-2007
Michael Fesser
 
Posts: n/a
Default Re: User status Online/Offline?

..oO(Onideus Mad Hatter)

>On Wed, 19 Dec 2007 19:23:31 +0100, Michael Fesser <netizen@gmx.de>
>wrote:
>>
>>But even this is just a wild guess and never really accurate. As said,
>>HTTP doesn't allow for accuracy here:
>>
>>* user sends request
>>* user gets answer
>>* user is gone
>>
>>It's always the same.
>>
>>Micha

>
>There are ways of doing it with Java or Flash 9...on the same level of
>accuracy you would get with an IRC channel...but that still includes
>people who visit a site, leave it on and then go to the grocery store
>or whatever.


So after all you gain nothing more from it than with plain HTML or maybe
some JavaScript.

Micha
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 03:21 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0