How to check member is online or not?

Go4Expert Member
27Aug2007,10:39   #1
hoangthienphuc's Avatar
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.
Team Leader
27Aug2007,10:54   #2
jwshepherd's Avatar
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;
Go4Expert Founder
27Aug2007,11:37   #3
shabbir's Avatar
People may not log off but close the browser and so a cron job should update the database for non existing sessions.