Free web hit counter

  • Thread starter Thread starter Martin R. Howell
  • Start date Start date
If the server you use runs php (most do now) then I would say make your own.

That way you don't have to "count" (sorry about the pun) on another server
to be up and running and your pages will load just a bit faster.

You can see "Stats" on the left hand side of all my pages for a working
example.

As this is pretty simple and small here is the code you would need.

1st make a file called counter.txt in notepad.
If you have 3000 hits just type 3000 on the first line and save the file.

2nd upload the file you just saved to your server.

3rd just cut and paste this code into every page you wish to show your hits
on.

<!--SHOW SITE HITS-->
<?php
$fp=fopen("counter.txt","r");
$count=fgets($fp,1024);
fclose($fp);
$fw=fopen("counter.txt","w");
$cnew=$count+1;
$countnew=fputs($fw,$count+1);
echo "<br>$cnew";
fclose($fw);
?>Hits
<!--END SHOW SITE HITS-->

Only kink is you may have to rename your file.
So if your page was index.html it might have to be changed to index.php but
that depends on your server.

If you don't have php or can't make it work then there are cgi scripts out
there but they are harder to setup.

Good luck.
 
James said:
If the server you use runs php (most do now) then I would say make your own.

That way you don't have to "count" (sorry about the pun) on another server
to be up and running and your pages will load just a bit faster.

You can see "Stats" on the left hand side of all my pages for a working
example.

As this is pretty simple and small here is the code you would need.

1st make a file called counter.txt in notepad.
If you have 3000 hits just type 3000 on the first line and save the file.

2nd upload the file you just saved to your server.

3rd just cut and paste this code into every page you wish to show your hits
on.

<!--SHOW SITE HITS-->
<?php
$fp=fopen("counter.txt","r");
$count=fgets($fp,1024);
fclose($fp);
$fw=fopen("counter.txt","w");
$cnew=$count+1;
$countnew=fputs($fw,$count+1);
echo "<br>$cnew";
fclose($fw);
?>Hits
<!--END SHOW SITE HITS-->

Only kink is you may have to rename your file.
So if your page was index.html it might have to be changed to index.php but
that depends on your server.

If you don't have php or can't make it work then there are cgi scripts out
there but they are harder to setup.

Good luck.
As a coincidence: I started a few days ago with studying the PHP
reference and tutorials. Want to try some things with it on my
website-in-the-making.
Copy/paste/upload and cool!! It workes! Yeah, yeah, of course but this
has acted as my "hello world" php, so to me it *is* a big deal.

OK, (wiping proud smile of my face), maybe one little addition to your
nice post:
I have an account on a Unix (Linux) server, so the "counter.txt" needed
its permissions changed to both read and write for the visitors op the
site (CHMOD-command).

Jsp
 
On Tue, 14 Dec 2004 11:36:19 -0600 in alt.comp.freeware, Bob Adkins
I don't go there. I just use their counter.

Wouldn't that mean that people using those ad blockers would not get
counted when they visit your web page?
 
Wouldn't that mean that people using those ad blockers would not get
counted when they visit your web page?

I really don't know, but I doubt it. It doesn't count my own visits, but I
assumed that was because it didn't count visits from the same IP range.

-- Bob
 
On Tue, 14 Dec 2004 11:36:19 -0600 in alt.comp.freeware,


Wouldn't that mean that people using those ad blockers
would not get counted when they visit your web page?

Yes, it very likely would.

J
 
I really don't know, but I doubt it. It doesn't count my
own visits, but I assumed that was because it didn't count
visits from the same IP range.

-- Bob

One way to find out: if the pages are for public consumption,
feel free to post a URL. (If you don't wish to post that on
usenet, drop me a PVT.)

J
 
Back
Top