PDA

View Full Version : Web page count ...


cdelecole
03-15-2006, 01:43 PM
Hi there !

I'm maintaining a web site on a UNIX server (index.html, ...), and would like to put page counters (The usual "You are visitor numer xyz) on some of the web pages.

Could some one indicate to me how to do this, in wither Javascript or CGI (The easier way the best ...)

Many Tanks !

mlseim
03-15-2006, 01:58 PM
To answer your question ...

This simplest is to use PHP ... see this example:
http://www.developingwebs.net/phpclass/hitcounter.php

http://www.webdesign.org/web/web-programming/php/easy-way-to-make-a-counter.4275.html



You would need to change the extensions of the pages from .html to .php
(index.php).

Javascripting along with Perl can also be used, but the method above
is easier. Many webhosts don't allow "Perl Execute Includes", but do
allow "PHP Includes".

=========================

To not answer your question ...

Why would you want a hit counter? They really don't mean anything these
days, and sort of give the site an "amateur" look to them.

If creating the hit counter teaches you some scripting skills, then it's a
good thing to do, but only for that reason.

You might want to consider using your webhost's built-in stats to view
information about site visitors, or collect data into a file without actually
having the "You are visitor number 2 Gazillion" ... after all, you can make
the counter say whatever you want (thus, it's really meaningless).

cdelecole
03-15-2006, 02:06 PM
To answer your question ...

This simplest is to use PHP ... see this example:
http://www.developingwebs.net/phpclass/hitcounter.php

You would need to change the extensions of the pages from .html to .php
(index.php).

Javascripting along with Perl can also be used, but the method above
is easier. Many webhosts don't allow "Perl Execute Includes", but do
allow "PHP Includes".

=========================

To not answer your question ...

Why would you want a hit counter? They really don't mean anything these
days, and sort of give the site an "amateur" look to them.

If creating the hit counter teaches you some scripting skills, then it's a
good thing to do, but only for that reason.

You might want to consider using your webhost's built-in stats to view
information about site visitors, or collect data into a file without actually
having the "You are visitor number 2 Gazillion" ... after all, you can make
the counter say whatever you want (thus, it's really meaningless).


Thanks a lot mlseim for your input.
I do not think I can use the .php because wy lab admin won;t be happy with it. We default our index files to ".html".

That is why I was looking for a simple javascript or cgi to do it.

To answer your question, since I'm not admin of that machine, I can't see what is in the "machine stats" and therefore the number of persons visiting my web pages.

I have an index.html calling something like 20 other html pages.
I was interested to see which ones are really used by users, and which ones not ...

mlseim
03-15-2006, 02:12 PM
CGI is a data transfer interface for PHP or Perl ... meaning, in either case,
you would need to use a server-side script. You need to be able to save
the number of hits in a data file, and you can't do that with Javascripting.

You might just ask the lab admin to give you a report on the number of
hits to your pages ... or let you access them. It's not a big deal for them.

You could also sign-up for a free hit counter (like www.sitemeter.com).