IPB

Welcome Guest ( Log In | Register )



Tags
This content has not been tagged yet
2 Pages V   1 2 >  
Reply to this topicStart new topic

Hit Counter

, simple hit counter

awarkops
no avatar
Newbie
*
Group: Members
Posts: 4
Joined: 17-December 05
Member No.: 15,852



Post #1 post Dec 17 2005, 12:59 PM
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
Go to the top of the page
+Quote Post
courage
no avatar
Newbie [Level 1]
*
Group: Members
Posts: 11
Joined: 7-January 06
Member No.: 16,734



Post #2 post Jan 8 2006, 04:08 AM
well i can say its not the easyest, but realy helpful! now people can't cry about couldn't get a hit counter smile.gif
Go to the top of the page
+Quote Post
bucksta
no avatar
Advanced Member
*******
Group: Members
Posts: 127
Joined: 6-December 05
Member No.: 15,438



Post #3 post Jan 8 2006, 04:42 AM
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.
Go to the top of the page
+Quote Post
Cerebral Stasis
no avatar
Braindead by Default
*********
Group: Members
Posts: 713
Joined: 5-November 05
From: United States of America
Member No.: 13,837



Post #4 post Jan 8 2006, 06:02 AM
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.
Go to the top of the page
+Quote Post
BD Photography
no avatar
Newbie [Level 1]
*
Group: Members
Posts: 23
Joined: 14-December 05
Member No.: 15,691



Post #5 post Jan 18 2006, 08:41 PM
QUOTE(awarkops @ Dec 17 2005, 12:59 PM)
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
[right][snapback]213642[/snapback][/right]

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.
Go to the top of the page
+Quote Post
bucksta
no avatar
Advanced Member
*******
Group: Members
Posts: 127
Joined: 6-December 05
Member No.: 15,438



Post #6 post Jan 21 2006, 03:17 PM
cool. il try it since i have a blank web site with nothing to put on the main page. a hit counter sounds good.
Go to the top of the page
+Quote Post
wassie
no avatar
-OLD ADMIN-
***********
Group: Members
Posts: 1,184
Joined: 20-June 04
From: the bath-tub...
Member No.: 50



Post #7 post Jan 22 2006, 05:42 PM
omg, then you have a emty website with only a hit counter 0.o
Go to the top of the page
+Quote Post
Dart-kun
no avatar
Super Member
*********
Group: Members
Posts: 252
Joined: 28-June 05
From: Canada
Member No.: 8,791



Post #8 post Jan 22 2006, 05:57 PM
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.
Go to the top of the page
+Quote Post
apollo
no avatar
Member [Level 1]
****
Group: Members
Posts: 68
Joined: 22-January 06
From: Latvia, Ogre
Member No.: 17,468



Post #9 post Jan 22 2006, 07:13 PM
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!
Go to the top of the page
+Quote Post
snlildude87
no avatar
Moderator
***************
Group: Members
Posts: 2,325
Joined: 8-March 05
From: Mawson, Antarctica
Member No.: 4,254



Post #10 post Jan 22 2006, 07:15 PM
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?
Go to the top of the page
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   13 KooL 1,744 31st August 2004 - 10:08 AM
Last post by: Too_Hot
No new   19 dask 1,306 4th August 2004 - 05:01 AM
Last post by: zyklon
No New Posts   2 gpinvest 867 19th July 2006 - 12:10 PM
Last post by: Florisjuh
No New Posts   6 KooL 390 21st September 2004 - 11:13 PM
Last post by: odomike
No New Posts   1 tomecki 1,129 31st August 2004 - 08:52 PM
Last post by: neeki4444
No new   15 -prodigy- 1,699 27th February 2005 - 10:22 PM
Last post by: alexia
No New Posts   5 blackhawk 553 31st August 2004 - 01:13 PM
Last post by: Spectre
No New Posts   2 ZorBiX 492 28th October 2004 - 09:14 AM
Last post by: ZorBiX
No new   34 MercifulFate 4,758 16th March 2005 - 07:26 PM
Last post by: AboveZero
No New Posts   3 outbreak 970 8th March 2005 - 10:21 PM
Last post by: Benz1435
No New Posts   1 cragllo 466 15th December 2004 - 05:13 PM
Last post by: predrag022
No New Posts   0 DoomTiger 484 18th December 2004 - 10:21 AM
Last post by: DoomTiger
No new   17 DoomTiger 1,624 8th January 2005 - 02:58 PM
Last post by: mrkill47
No New Posts   4 -deathknight- 2,799 4th May 2007 - 02:15 AM
Last post by: tejana
No New Posts   3 podbicanin 2,510 14th April 2008 - 03:10 AM
Last post by: FeedBacker