listing online users
Posted 27 June 2006 - 11:11 AM
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
Posted 27 June 2006 - 11:44 AM
[a href=\"http://www.llstudios.net/directory/16-1\" target=\"_blank\"]http://www.llstudios.net/directory/16-1[/a]
[br][br]The truely intelligent people are not those who create the dots; rather they are they ones with the ability to connect the dots into a coherent picture
all the brothers were valiant!
Posted 27 June 2006 - 11:51 AM
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 user
ip: hold the ip
username hold the username, if not found, put a value of 'guest'
timestamp: the time stamp of last accessing
you 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.
remember, those are just designing.
Posted 27 June 2006 - 12:01 PM
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.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users