Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   How to check member is online or not? (http://www.go4expert.com/forums/check-online-t6058/)

hoangthienphuc 27Aug2007 10:39

How to check member is online or not?
 
I am trying to build a statictis utility in my CMS website. This utility will list of user_member (register) in the systems is online or not and it get IP address of that member pc and display information about their visited history ( They has visited other pages before enter my pages ).
I tried to solve this problem for a long time but it's still not effective. How to do that? Please help me. Thanks for any response.

jwshepherd 27Aug2007 10:54

Re: How to check member is online or not?
 
using session variables is the easiest way for the first part but adding the extra information may require another database table
TABLE tbl_online
user | active | ip | referer

In the login.php page add a line to insert a record containing the userid, a 1,the ip, http_referer
in the logoff page update the table active from 1 to a 0 (inactive)

use select * from tbl_online where active <>0;

shabbir 27Aug2007 11:37

Re: How to check member is online or not?
 
People may not log off but close the browser and so a cron job should update the database for non existing sessions.


All times are GMT +5.5. The time now is 15:24.