I have a special question: I want to know how many people are at that moment accessing my home page (only one certain one), and would make about this a counter. I assume to that people stay on a page for 1 minute, if no refresh comes from this page, than the user is gone. How can I do that? Or is another way to see that? (maybe something like a mini vnc server with a iframe function in the home page, whereby I can see the active connection to the server ???? Just want to say, it does not matter how I can solve it, I just want to know how many people read the page at the same time) bye Ronald
On Sat, 29 Jun 2002 00:12:00 +0800 Ronald Wiplinger <ronald@elmit.com> wrote:
I want to know how many people are at that moment accessing my home page (only one certain one), and would make about this a counter.
I assume to that people stay on a page for 1 minute, if no refresh comes from this page, than the user is gone. How can I do that? Or is another way to see that?
(maybe something like a mini vnc server with a iframe function in the home page, whereby I can see the active connection to the server ???? Just want to say, it does not matter how I can solve it, I just want to know how many people read the page at the same time)
All you need to do is write a cgi program that monitors /var/log/httpd/access_log . The cgi can loop thru the log looking for how many differnet ip numbers are getting your page within a set time period. You could have the cgi password protected or use htaccess so only you can view it. Another way to do it, is to use a cgi program to serve out your html page. Instead of an index.html page, you have a index.cgi ; whose sole purpose is to send out your index.html and keep track of how many different ips are being fed, with a timespan set by you. It could write the data to a file which you could read however you want. -- use Perl; #powerful programmable prestidigitation
zentara wrote:
On Sat, 29 Jun 2002 00:12:00 +0800 Ronald Wiplinger <ronald@elmit.com> wrote:
I want to know how many people are at that moment accessing my home page (only one certain one), and would make about this a counter.
I assume to that people stay on a page for 1 minute, if no refresh comes from this page, than the user is gone. How can I do that? Or is another way to see that?
(maybe something like a mini vnc server with a iframe function in the home page, whereby I can see the active connection to the server ???? Just want to say, it does not matter how I can solve it, I just want to know how many people read the page at the same time)
All you need to do is write a cgi program that monitors /var/log/httpd/access_log . The cgi can loop thru the log looking for how many differnet ip numbers are getting your page within a set time period. You could have the cgi password protected or use htaccess so only you can view it.
That is not a good way, since I have 500 virtual domains and all report into one log file !!!
Another way to do it, is to use a cgi program to serve out your html page. Instead of an index.html page, you have a index.cgi ; whose sole purpose is to send out your index.html and keep track of how many different ips are being fed, with a timespan set by you. It could write the data to a file which you could read however you want.
That sounds good! Do you have any starting index.cgi handy? Thanks! bye Ronald
On Sat, 29 Jun 2002 12:44:27 +0800 Ronald Wiplinger <ronald@elmit.com> wrote:
That sounds good! Do you have any starting index.cgi handy? Thanks!
Well I got a rudimentary method going. Here it is. I'm sorry, but you will need to take it from here. There are so many details with the server etc., that you must deal with. I edited my httpd.conf to add the following: <Files index.html> Options +ExecCGI SetHandler cgi-script </Files> You may be able to put this in an .htaccess file instead of editing the httpd.conf, it depends on how restrictive your httpd.conf is setup. I renamed the index.html to index1.html. Then I put the following cgi script in there as "index.html" ###################################################### #!/usr/bin/perl use warnings; use strict; use CGI; my $homepage = 'http://zentara.zentara.net/~zentara/index1.html'; my $ipaddy=$ENV{'REMOTE_ADDR'}; my $time = localtime(); open (AL,"+>>indexaccess.log"); print AL "$ipaddy\t$time\n"; close AL; print "Location: $homepage\n\n"; ###################################################### You will have to choose a way to view the indexaccesslog, you probably can read it by entering it's url thru a browser and refreshing as often as needed. Good luck, -- use Perl; #powerful programmable prestidigitation
participants (2)
-
Ronald Wiplinger
-
zentara