Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining # of users online

Status
Not open for further replies.

Omicron

Technical User
Jul 15, 2001
32
US
Hello,
I've come across websites that states something like
"There are currently 12 guests online at this time".
How is something like that coded into the webpage? I assume it is some exec or cmd function but I do not know for sure. Can someone show me how that is accomplished?
Thank you.
- Omicron -
Compuset Portal
 
They are probably reading unique IP's and assuming that each person stays on for a certain amount of time before "expiring" their visit. HTTP is a stateless protocol, so there is no method to actually determine if someone who made a single request is still looking at the result from that request or intends to make more requests. So this assumed number is just going to be a guestimate. In reality, it is the number of people who have hit the site in the last iteration of the prescribed time block. Or in the event that this site has member logins, it may be the number of people who have logged into the site and not logged out nor exceeded the time-out period. Anyway, it is not a simple "exec" command... you'll have to write a CGI script to handle it, and in the end it won't be accurate. Sincerely,

Tom Anderson
Order amid Chaos, Inc.
 
Thanks Tom,
I checked the source code of the website but whatever code they are using must be generating the HTML on-the-fly, because all that can be seen is the <p> tag showing: &quot;There are currently 12 guests online at this time&quot;. No calls to cgi or paths to cgi-bin directories are there. I just have always been intriqued with the mechanics of such code since I've never run across any pre-designed scripts that do this.
Regards,

- Omicron -
Compuset Portal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top