[PHP] Re: how to see all sessions sets in server

2013-08-05 Thread Alessandro Pellizzari
Il Sun, 04 Aug 2013 20:47:37 +0430, Farzan Dalaee ha scritto:

Please use better quoting.

> So best way is use a script(javascript) to send ajax to server every 5
> second to check users is logged in or not? Is that okey?

It depends.

> I want to write chat module like facebook and i need a solution to find
> online users and way to send messages when users chat together, does any
> one write similar module like that?

Then knowing who is online is maybe the last of your problems.

You have to find a way to send the message to "user B" when "user A" 
writes something.

You absolutely need javascript. You just need to find out how to connect 
to the server. Have a look at socket.io, and find a php library that 
supports it. I think it is the easiets way.

Be aware that the load on your server will be huge, growing exponentially 
with the number of online users. You can't escape it, except by using 
different technologies (XMPP as a protocol, with a javascript client, or 
using node.js with socket.io, for example)

Bye.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to see all sessions sets in server

2013-08-04 Thread Ashley Sheridan
On Sun, 2013-08-04 at 13:27 +0100, Tim Streater wrote:

> On 04 Aug 2013 at 11:28, Ashley Sheridan  wrote: 
> 
> > Like Matijn said, unless you're using some kind of client-side method to
> > continually poll the server, you can't know if they've just closed their
> > browser. There are Javascript events for exiting a page, but they don't
> > work correctly on Safari and iOS Safari.
> 
> onbeforeunload works fine in Safari; I use it all the time.
> 
> --
> Cheers  --  Tim
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


Apparently it has problems when browsing in "porn" mode, and mobile
safari has major problems with it. I'm basing this on previous posts on
forums I've been on, so it might have been fixed now, but I don't know
for sure either way.

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] Re: how to see all sessions sets in server

2013-08-04 Thread Tim Streater
On 04 Aug 2013 at 11:28, Ashley Sheridan  wrote: 

> Like Matijn said, unless you're using some kind of client-side method to
> continually poll the server, you can't know if they've just closed their
> browser. There are Javascript events for exiting a page, but they don't
> work correctly on Safari and iOS Safari.

onbeforeunload works fine in Safari; I use it all the time.

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: how to see all sessions sets in server

2013-08-04 Thread Alessandro Pellizzari
Il Sun, 04 Aug 2013 13:32:55 +0430, Farzan Dalaee ha scritto:

> hi i want to write online user module for my site and i want to check
> $_SESSION['userID'] to find all users id who loged in but when i echo
> this code its return only current user detail how i can see all
> sessions?

You can't.

>  or how i handle online users?

Every user has its session.

If you want to have a "super user" who has access to all the sessions, 
you can use the filesystem functions to read the directory in which the 
sessions get saved (it depends on the server configuration) or you can 
implement a session handler to save all the sessions in the database, and 
give access to that table to one user.

Bye.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php