Welcome Guest ( Log In | Register)



 
Closed TopicStart new topic
> Hit Counter, simple hit counter
awarkops
post Dec 17 2005, 12:54 PM
Post #1


Newbie
*

Group: Members
Posts: 4
Joined: 17-December 05
Member No.: 15,852



ok just copy this code to the location y
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

Closed TopicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Does any one have a php counter script?(15)
  2. Visitors Counter(4)
  3. Php Counter(3)


 



- Lo-Fi Version Time is now: 8th October 2008 - 05:55 AM