PDA

View Full Version : Who is online?



Myth_Pharoah
July 29th, 2001, 03:29
Any of you guys have an idea how does it work at these Bulletin Boards?

Even this one has it! :)

polestar
July 30th, 2001, 07:32
The board keeps a record of who is currently signed in.

Myth_Pharoah
July 30th, 2001, 08:05
You are you specific Poletstar!

I need to know how it works not what it does. The code I mean!

atlas
July 30th, 2001, 16:59
It's not that hard. These types of sites have people log in and get a session. So all you have to keep track of is the list of people that are currently logged in.

The easiest method is to keep updating the expiration of the session ahead 30 minutes from the current time each time a user accesses a page. Then after they stop accessing pages their session is deleted -- and therefore removed from the "who is logged in" page.

Anyway, that's the basic idea.

-mk
atlascgi.com

Myth_Pharoah
July 30th, 2001, 23:05
Is there any where I can find out how the code works? CAn any of you guysd explain in PHP. Cause I'm making a BBS and I need to have that. Anyone who can do that for me will get credit! :)

lucifer
July 31st, 2001, 04:31
step 1

setup a db

time/date | unique ID

step 2

each page checks for $ID if exists (and is valid) it updates the record in the db. If invalid or none creates new ID and stores in db

step 3

?$ID=xxxxx added to each link

that would work but you have session tracking don't you. just adapt that.

Myth_Pharoah
July 31st, 2001, 23:51
I doin't exactly understand. Is thre any way any of you guys can strip a piece of code from some where in PHP and show me?