Code Wanted

They have: 10 posts

Joined: Jan 2002

Hi All

I am after some code/script that I can use on my pages to display the number of visitors currently on.

Any help please

Thanks

Busy's picture

He has: 6,151 posts

Joined: May 2001

I think you'd have to use cookies and a database, I could be wrong, but I'm pretty sure its server side

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

yes, this is a server side question. moving her along to the right forum, please stand by.

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I use a database, sessions, and cookies to manage this. Here is the very basic concept...

Remove all sessions older than a 'time to live' (I've set this to 60 minutes for some projects, and 10 minutes on others).
Check for the existance of a session. If one exists, the ID will be passed via cookie or GET/POST method.
If one exists, update the last_activity field (timestamp).
If one does not exist, create a unique id (timestamp with MD5 is nice for this) and insert this into the DB.

Mark Hensler
If there is no answer on Google, then there is no question.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.