Loading...


bookmark - Hit Counter simple hit counter

Hit Counter - simple hit counter

 
 Discussion by awarkops with 14 Replies.
 Last Update: February 22, 2006, 10:01 am
 
bookmark - Hit Counter simple hit counter  
Quickly Post to Hit Counter simple hit counter w/o signup Share Info about Hit Counter simple hit counter using Facebook, Twitter etc. email your friend about Hit Counter simple hit counter Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

ok just copy this code to the location you want the counter on

PHP Code

QUOTE

<?php
  $file = 'counter.txt';

  if(!file_exists($file))
  {
      $handle = fopen($file, 'w');
      fwrite($handle, 0);
      fclose($handle);
  }

  $count = file_get_contents($file);
  $count++;

  if(is_writable($file))
  {
      $handle = fopen($file, 'w+');
      fwrite($handle, $count);
      fclose($handle);
  }
  else
  {
      echo 'Could not increment the counter!<br />';
  }

  echo number_format($count).' Hits';
?>

open notepad and save it as counter.txt then upload it to the director you put the code on the php page a set the permission to 777

when adding this code to you page make sure you save you page as name.php
and not as name.htm or name.html or if you have php activation in html u can just save it as html

im cant remember how to activate php in html if some one can tell me it will help

   Sat Dec 17, 2005    Reply         

well i can say its not the easyest, but realy helpful! now people can't cry about couldn't get a hit counter :)

   Sat Jan 7, 2006    Reply         

hit counters are easy to make. all you need is some php knowledge and thats all. its harder making a mySQL hit counter but somehow it turns out better.

   Sat Jan 7, 2006    Reply         


I assume this counter actually counts specific hits, so if one sits in a page and refreshes, the counter will continue to go up, right? I, personally, am only interested in counters that actually count unique visitors or at least unique hits. Perhaps you could create a tutorial explaining how to create a counter that works that way.

This "tutorial" may be quite useful, but I'm afraid to say it can hardly count as a tutorial, since it doesn't teach one anything, nor does it explain what the individual parts mean or do.







   Sat Jan 7, 2006    Reply         

QUOTE (awarkops)

ok just copy this code to the location you want the counter on

PHP Code

open notepad and save it as counter.txt then upload it to the director you put the code on the php page a set the permission to 777

when adding this code to you page make sure you save you page as name.php
and not as name.htm or name.html or if you have php activation in html u can just save it as html

im cant remember how to activate php in html if some one can tell me it will help


that sounds cool and all. however i jsut dont like other people to see how many other people have visited my site. i like the hit counters taht jsut allow you so see how many people visited your site and at what time of teh day.

   Wed Jan 18, 2006    Reply         

cool. il try it since i have a blank web site with nothing to put on the main page. a hit counter sounds good.

   Sat Jan 21, 2006    Reply         


omg, then you have a emty website with only a hit counter 0.o

   Sun Jan 22, 2006    Reply         

It's a good tutorial if not a tad short, and pretty simplistic.

I recently searching for a hit counter aswell, and ended up finding one that records unique hits each day. So if someone was to Visit my site, it would count 1. No matter how many times they refreash with 24 hours, another hit won't be counted. But after 24 hours, it would raise to 2. It's pretty nice, was just a PHP counter, but it was good. But I ended up losing it, and not being able to find it.

Perhaps next time you could make one like this? I'm sure alot of people would like it aswell.

   Sun Jan 22, 2006    Reply         

Hello. I`m new memmber. As courage saied it`s a bit hard for new member, but i`m not begginer with HTMl and PHP, but anyway, it`s not working for me....

Thnx, apo!

   Sun Jan 22, 2006    Reply         

Nice code, but why would you make your own when you can have another hit counter done professionally from a site such as statcounter.com that counts unique visitors and shows specific details about each visitor?

   Sun Jan 22, 2006    Reply         

thanks on the tutorial ill try and it and see how it works out thanks man...

   Tue Jan 24, 2006    Reply         

thanks man :(

   Fri Jan 27, 2006    Reply         

:)

Seems easy and simple, thanks.

   Sun Jan 29, 2006    Reply         

This is deffinietely better than the "free counter" piece of junk I've been having to use for quite a while. Thanks.

   Sun Feb 5, 2006    Reply         

Nice smple and good tnx

   Wed Feb 22, 2006    Reply         

Quickly Post to Hit Counter simple hit counter w/o signup Share Info about Hit Counter simple hit counter using Facebook, Twitter etc. email your friend about Hit Counter simple hit counter Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Similar Topics:

Php Hit Counter

All you do is copy this code into the page you want to display it on. CODE<?php $counterfile = "counter.txt"; $counter = file("$counterfile"); $c = $counter[0]; if (strlen($c) == 0 ...more

   06-Dec-2004    Reply         

Php Unique Hit Counter

Hello all, Here is a neat and helpful PHP script that can count unique page views on your website. First you need to open up a new page in your text editor and paste in this code. CODE <?php $filename = "hits.txt"; $file = file( ...more

   07-Mar-2005    Reply         

I Want A Good Hit Counter

hi, i want you guys to suggest me a good hit counter. i already got a one using java script but it may be not very accurate. a few days ago, i used this wordpress plugin ( CHICKUN COUNT REPORTING ). it is a hit counter for the whole website and for a certain page, it gives me more accurate results. ...more

   04-Apr-2010    Reply         

Get Rid Off Recycle Bin From The Desktop plus bypass it if dont want to remove it   Get Rid Off Recycle Bin From The Desktop plus bypass it if dont want to remove it (6) (0) Ie Download Limit   Ie Download Limit