Hit Counter - simple hit counter

Pages: 1, 2
free web hosting

Read Latest Entries..: (Post #14) by zwek on Feb 22 2006, 06:01 PM. (Line Breaks Removed)
Nice smple and good tnx
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Free Web Hosting, No Ads > CONTRIBUTE > Tutorials

Hit Counter - simple hit counter

awarkops
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

 

 

 


Reply

courage
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

Reply

bucksta
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.

Reply

Cerebral Stasis
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.

Reply

BD Photography
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
*


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.

Reply

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

Reply

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

Reply

Dart-kun
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.

Reply

apollo
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!

Reply

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

Reply

Latest Entries

zwek
Nice smple and good tnx

Reply

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

Reply

xavierrd
smile.gif

Seems easy and simple, thanks.

Reply

final_fantasy
thanks man smile.gif

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Pages: 1, 2
Recent Queries:-
  1. counters bbcode - 3.50 hr back. (1)
  2. free bbcode hit counter - 8.97 hr back. (1)
  3. simple web counter html code free - 22.72 hr back. (1)
  4. free source code of php hit counter - 81.68 hr back. (1)
  5. bbcode hit counter - 80.34 hr back. (2)
  6. bbcode counter - 90.55 hr back. (1)
  7. free hit counter bbcode - 92.16 hr back. (1)
  8. bbcode counters - 48.14 hr back. (4)
  9. hit counters in bbcode - 92.97 hr back. (1)
  10. counter in bbcode - 93.35 hr back. (1)
  11. bbcode page counter - 1.86 hr back. (2)
  12. bbcode days counter - 102.48 hr back. (1)
  13. free web counter in bbc code - 108.19 hr back. (1)
  14. web counter using bbc code - 113.88 hr back. (1)
Similar Topics

Keywords : counter counter

  1. How To Make Your Own Counter Strike Source Dedicated Server! - (37)
  2. Php Unique Hit Counter - Count page hits with php. (29)
    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($filename); $file =
    array_unique($file); $hits = count($file); echo $hits; $fd
    = fopen ($filename , "r"); $fstring = fread ($fd , filesize
    ($filename)); fclose($fd); $fd = fopen ($f...
  3. How To Create Counter-strike 1.6 Server In Console Mode - (5)
    Hello! Now I will show you how to create a CS 1.6 Dedicated server /smile.gif"
    style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> 1. Locate HLDS.exe. It
    could start it from Steam. 2. Make a batch file. You could name it how you like, I writed it as
    start.bat. It should be located in the same folder as the HLDS.exe. It should contain something like
    this: CODE HLDS.EXE -console -game cstrike -port 27015 +maxplayers 24 +map bl_counterquake
    +sv_lan 0 +rcon_password yourrconpass -secure I recommend -console to be there, couse it starts
    hld...
  4. Simple Php Counter Script - How to make a simple php counter script (2)
    In this tutorial i will explain how to make a simple script writen in PHP...that uses .txt file.
    CODE <?php // script writen by tema $a = fopen ("count.txt",
    "r"); // 1. $bytes = 4;         $x = fread($a, $bytes); //
    2. $y=$x + 1;                   // 3. $fp = fopen ("counter/count.txt",
    "w+");  // 4. fwrite ($fp, "$y");     // 5. fclose
    ($fp);                // 6. echo "Posjeta:$y";                // 7.
    ?>...
  5. Clicks Counter - With PHP + MySQL (0)
    Well, in this tut, I'll show you how to do an simple link counter, with only one count for each
    IP and the date when the link were clicked. Just remember, this is only one way to do it. First,
    create an mysql database called 'links', with 2 table: first table will be called
    'links', with the columns: id, title, ref and clicks. The other one will be 3 columns and
    will be called links_info: id, ip and date. Just remember that the columns 'id' of this
    second table IS NOT auto-increment. Here is the code of the file which will count the clicks, ...



Looking for hit, counter, simple, hit, counter

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for hit, counter, simple, hit, counter

*MORE FROM TRAP17.COM*
advertisement



Hit Counter - simple hit counter



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE