users who are now connected to site .... something like a lot of forums have (example: There are 8 Active Users, 3 Guest(s) and 5 Member(s) ).<BR><BR>I hope it's good definition, because i'm not very good at explaining things :)
For the number of active session you can place this in global.asa<BR><BR><script language="vbscript" runat="server"><BR>Sub Application_OnStart<BR> Application("visitors")=0<BR>End Sub<BR><BR>Sub Session_OnStart<BR> Application.Lock<BR> Application("visitors")=Application("visitors")+1< BR> Application.UnLock<BR>End Sub<BR><BR>Sub Session_OnEnd<BR> Application.Lock<BR> Application("visitors")=Application("visitors")-1<BR> Application.UnLock<BR>End Sub<BR></script><BR><BR>And then response.write Application("visitors") anytime you need to display the active users.<BR><BR>Unfortunately I dont know how to track members leaving the Session_OnEnd event has already lost the session.<BR><BR>Would appreciate any help from someone with this as i need to do this myself.<BR><BR>
May have a solution here.<BR>after looking at the source code for a free asp forum (http://www.pd9soft.com/) I found this method.<BR><BR>Basicaly you create an 'online' table in your db. Every time a member does something (via an include in every page) his 'last activity' field is updated.<BR>At the same time every entry that has a 'last activity' of more that 20 minutes (or whatever your session.timeout is set to) can be removed.<BR>This way the online table holds the Member ID's of any members who have visited a page within the last 20 minutes.<BR><BR>A simple count of this tables entries then returns the number of members online. Looping through it will let you list the users online.
...is to keep the list of users in an array and keep the array in an Application variable.<BR><BR>This allow you to quickly show all users online to other users.<BR><BR>You could keep IDs, names, when logged in, etc., all in a single 2D array, but it might be better to use parallel arrays.<BR><BR>Names in one array.<BR><BR>Other info in another array.<BR><BR>That way, you could show all users online via something as simple as this in an ASP page:<BR><BR>*********<BR><UL><BR>< LI><%= Join( Application("OnlineUsers"), vbNewLine & "<LI>" ) %><BR></UL><BR>*********<BR><BR>