uraniumdeer Posted June 27, 2006 Share Posted June 27, 2006 I'm still quite new to PHP but threw myself into a bigger project, I'm trying to caode a forum.I do realize that it's a big task, but I'm not that far from finishing it.My problem is that I'd like to list the users that are online, much like this forum does, list logged in people, and visitors - but i have absolutely no idea how to do this.Any help would be appreciated - a push in the right direction will suffice, though a solution with comments to explain how it work would be really nice :) Quote Link to comment https://forums.phpfreaks.com/topic/13011-listing-online-users/ Share on other sites More sharing options...
litebearer Posted June 27, 2006 Share Posted June 27, 2006 As a start, might take a look here...[a href=\"http://www.llstudios.net/directory/16-1\" target=\"_blank\"]http://www.llstudios.net/directory/16-1[/a]Lite... Quote Link to comment https://forums.phpfreaks.com/topic/13011-listing-online-users/#findComment-50045 Share on other sites More sharing options...
hvle Posted June 27, 2006 Share Posted June 27, 2006 hi,This is a not something that can be achive easily and quickly. You need to consider your designing and structure of your code.There are many ways to achieve this, but this is within my experience:1. a session table. This table have fields like this:sessionid, ip, username, status, timestamp.sessionid hold the session id of userip: hold the ipusername hold the username, if not found, put a value of 'guest'timestamp: the time stamp of last accessingyou can add extra field like page url to store the current page user is viewing (last click).2. on every page, put a session code. This code update the status of user and the time stamp based on session id. if sessionid not exist, create one. (This is where the complicated work done).3. to display the user online, simply query the session table to find out.that's it.remember, those are just designing. Quote Link to comment https://forums.phpfreaks.com/topic/13011-listing-online-users/#findComment-50048 Share on other sites More sharing options...
uraniumdeer Posted June 27, 2006 Author Share Posted June 27, 2006 Thanks a bunch - off to mees around with it then :) Quote Link to comment https://forums.phpfreaks.com/topic/13011-listing-online-users/#findComment-50049 Share on other sites More sharing options...
hvle Posted June 27, 2006 Share Posted June 27, 2006 oh yes, i forgot to mention this. on step 3 when you read out session users, you will compare the timestamp in the table, against the current timestamp. If the difference was too large, i.e. idle time exceeded, delete this user.and I just though of something else too. You do not need the status field. simply delete the user if he/she exceed the idle time. Quote Link to comment https://forums.phpfreaks.com/topic/13011-listing-online-users/#findComment-50051 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.