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

The Number of Users on my site !!

Status
Not open for further replies.

SciFiSi

Technical User
Dec 30, 2000
14
GB
Hi

I hope someone can help me.

I have seen, and am looking a script that can be used on a web page, that tells you how many people are currently VIEWING your site.

Have you seen one? If so please tell me.

I'm also unsure if the script would be cgi or java.

Thanks
Simon
 
It is impossible to tell how many people are "viewing" your site ( unless you use some
SSL stuff or similar). You can tell when a user made a request for a page from your
server. But you can't tell if that user is still looking at the page your server
returned or if they have gone elsewhere. The connection between the user and the
server closes once the page is delivered to the browser. If you want to know who
made requests of your server and when, that information is generally available in your
web server logs. You can write a little code to parse you logs or even do some simple
report generation by pulling them into QuattroPro or EXCEL.

Does that speak to what you are chasing? If not, what exactly is it you want to do?


keep the rudder amid ship and beware the odd typo
 
Hi GoBoating

What you refer to about the server closing once the page is delivered to the browser is correct, but I have found a way of doing it, but I don't know how to impliment it.

It involves ASP....

Apparently you need the following in a global.asa file
------------------------------------------------------
<SCRIPT LANGUAGE=&quot;VBScript&quot; RUNAT=&quot;Server&quot;>

Sub Application_OnStart
' Set our user count to 0 when we start the server
Application(&quot;ActiveUsers&quot;) = 0
End Sub

Sub Session_OnStart
' Change Session Timeout to 20 minutes (if you need to)
Session.Timeout = 20
' Set a Session Start Time
' This is only important to assure we start a session
Session(&quot;Start&quot;) = Now
' Increase the active visitors count when we start the session
Application.Lock
Application(&quot;ActiveUsers&quot;) = Application(&quot;ActiveUsers&quot;) + 1
Application.UnLock
End Sub

Sub Session_OnEnd
' Decrease the active visitors count when the session ends.
Application.Lock
Application(&quot;ActiveUsers&quot;) = Application(&quot;ActiveUsers&quot;) - 1
Application.UnLock
End Sub

</SCRIPT>
-------------------------------

And the following in an .asp page on the site....
-------------------------------
<%@ Language=VBScript %>
<html>
<head>
</head>
<body>
<div align=&quot;center&quot;><b><font color=&quot;#80FF80&quot;><%= Application(&quot;ActiveUsers&quot;) %></font>Active Users</b></div>
</body>
</html>
-------------------------------

This is all well and good, I have seen it working but have no knowledge of asp, so unless you have any advice, it's back to the drawing board.

MMmmmm

Simon
 
Sorry, I don't do any ASP/VB stuff. :-(


keep the rudder amid ship and beware the odd typo
 
Hi Wullie

The User, I am going to have a chat room somewhere on the site so an indicator on the homepage of how many users on the site might be useful

Thanks
Simon
 
Hi,

I have one solution, but it may only work if you don`t already have a chat script to use.

I have found a free chat script that you can totally customise for the look and feel of your site and I have noticed an add on script to place on your main pages etc, that tells you how many users are in the chat but I have not tried this particular script myself.

One bug I have found in the chat is that the users must click log off when they are leaving the chat or they are still shown as online, you have to clear their name from a text document to remove them from the list.

It`s up to you mate, even if you got the add on you are wanting and tried to customise that for your own chat room.

The site is
Hope this helps, let me know how you get on.

Wullie

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top