Jump to content
xisto Community
awarkops

Hit Counter simple hit counter

Recommended Posts

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

PHP Code

<?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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

213642[/snapback]

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.