Navigate
Home
ArticleWiki
Forum
Journal
Search
Newsletter
Links
Tech News
expertsrt.com
Welcome Guest.
Username:

Password:

Remember me

count guests online
Welcome, Guest. Please login or register.
January 08, 2009, 10:26:17 PM
11313 Posts in 1251 Topics by 508 Members
Latest Member: pissematbox
Experts Round Table Network  |  Serverside Technology  |  PHP  |  count guests online « previous next »
Pages: [1]
Author Topic: count guests online  (Read 563 times)
seandelaney
Mentor

Offline Offline

Posts: 119



WWW
« on: January 24, 2006, 12:39:26 PM »

im developing a site where i want to track number of guests currently active but im not too sure how it works and im a little confused...

at the moment if a member logs in, i create a session with their uid, username, ipaddress, timestamp and the member can view any protected pages.  this all works fine and the session ends when they logout.

what i want now is too not only count logged in members (count active sessions), but also count non-members (guest)using sessions too, but am getting myself confusing on how to count both types.

hoping somebody can explain to me what i need to do?
Logged

COBOLdinosaur
ERT.com Admin

Offline Offline

Posts: 481



WWW
« Reply #1 on: January 24, 2006, 01:40:23 PM »

When they hit the site you deliver set session to track them and issue a page.  When they login you flag their session as logged in.  Total guests  = total active sessions - total logged on sessions.
Logged
Zyloch
Site Builder

Offline Offline

Posts: 8


« Reply #2 on: January 24, 2006, 01:48:42 PM »

To add onto Cd&'s point, most likely the medium of storage would be your database which provides an easy way to count the number of records. You could have another field called 'active'
Logged

Ted
seandelaney
Mentor

Offline Offline

Posts: 119



WWW
« Reply #3 on: January 25, 2006, 05:33:15 AM »

Thanks guys.

I found a class that handles sessions for guests so i intergrated that into my code, so now ive got both guest sessions been counted and registered member sessions been counter and both displaying on the same page which i wanted...

Thanks  :D  :glasses7:
Logged

Srirangan
Moderator
*
Offline Offline

Posts: 52



WWW
« Reply #4 on: January 25, 2006, 06:00:54 AM »

Sean, could you let me know which class you used. Thanks. :)
Logged

I rant therefore I am!
seandelaney
Mentor

Offline Offline

Posts: 119



WWW
« Reply #5 on: January 25, 2006, 06:09:22 AM »

Hi Srirangan,

Yes I found it from here:

http://www.zend.com/codex.php?id=1313&single=1

As i said, i had to tweak it abit to get it to work with my code to do "what" i wanted it to do.

As it stands, the code will just count guests and nothing else.  If you need a hand to count both like i have, just ask...

p.s remember we chated other day bout your PHP script to read RSS from google etc and you where having trouble... well i was looking through my library and came across a XML tips and hacks book that had example on how to read news alerts, news item from yahoo and google.

if you would like to see a PDF copy of the articles, just ask again...

Sean  :glasses7:
Logged

Pages: [1]
« previous next »
    Jump to: