i want to write a script that shows...
how many user is online..
how many guess is online..
display their user names...
just like in the frontpage of this forum...
anyone have any ideas on where i should start looking??
thx
i want to write a script that shows...
how many user is online..
how many guess is online..
display their user names...
just like in the frontpage of this forum...
anyone have any ideas on where i should start looking??
thx
Well i presume you already have a members table. So just add another feild called online
maybe use 1 for online and 0 for off or yes, no
Your choice
Then for guests its quite simple.
You may wanna use sessions but its not nessacary
Id just make a table called guets
Have IP, File and the time
Then from there
Delete anything thats after a certain time maybe 5mins
Now this isnt really giving you code but if you want some assitance, just PM
Further assistance (and code) is available by searching these forums with the keywords users online.
i got a few question about planetsim's method..
i have a members table...
i guess creating a online table isn't that hard..
and the idea sounds good...
but how do you detect if a user closed their browser
or leave the site?
if a browser leave the site... then in the online table i have to set that user's online status back to 0...
also how would you delete anything after certain amount of time???
is it possible to keep track of all the session opened??
since each session will contain user infomation...
their ip and user name... etc..
so i could look inside all the session and get my list of users??
or is that impossible?
why dont u just look at code of forums? most forums have this function im sure its not to hard to find just download phpBB or something.
yeah...~ i did search users online...
and i found some interesting things...
i've also looked at phpBB...
i think the way they've done it is really clever...
thx for everyone's help...
i know the concept now...
i'll start coding....
well yup. It is very easy. Its just hard at first to comprehend
http://www.phpbuilder.com/board/showthread.php?s=&threadid=10221915
Have a look at my post on there - its how i do it
just make that "online" field be a datetime
or what I do is have the a "logged in" field update on a users table entry each time they load a page.
then just select on all users from now - 5minutes or whatever.
then hide a frame that updates itself every 5 minutes (so you know the people are still "logged out"
and there you go.
Dont have it datetime. you should be using timestamp
cos your gonna use time();
then from there you can substract 300 which equal 5mins
You can make that longer or shorter buts it what most people stay on a page.