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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show how many using site ?? 1

Status
Not open for further replies.

blondends

Technical User
Apr 25, 2003
84
GB
Hi,

I have seen on a few site now that they have a facility where by you can see how many are logged on/ using the site.

Does anyone know how this is done? I thought that they might have just looked at how many users have logged in to the site and then wait for the them to log out... but, they also mention guest users - who don't log in. So how do they work that out ? I can only think of a server varilble that holds that info.

I am using a Unix server running MySQl.

Thanks in advance,

Chris
 
Best way to do it is to update an application variable with a session start in the global.asa.

Sub Session_OnStart
application.lock
if application("users") = "" then application("users") = 0
application("users") = application("users") + 1
application.unlock
end sub

sub session_onEnd
application.lock
application("users") = application("users") - 1
application.unlock
end sub

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Thanks for the quick reply. Although i am a bit confused. I am using a rented server and i would like to disply number of users accessing the site on a web page. Will your solution work for this ?

Thanks again,

Chris
 
Yes, everytime a new person visit the asp site, the session_onstart event fires adding one to the count. When their session times out, the session_onend event removes them from the count.

This code is in the global.asa file.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top