PHP Classes

File: counter_report.php

Recommend this page to a friend!
  Classes of David Higgins   CCounter   counter_report.php   Download  
File: counter_report.php
Role: Application script
Content type: text/plain
Description: This is an administrative report for CCounter
Class: CCounter
Simple flat-text file counter
Author: By
Last change:
Date: 21 years ago
Size: 1,900 bytes


Class file image Download


  This is a report page written for the CCounter class

  Written by David Higgins (

  Questions, comments or suggestions:

  This file is to be placed in the same directory as your
  counter.dat file. You may make this page public, but it
  is suggested to keep the page private ... as it displays the
  ip's of all your visitors ...

  This is just an extra additive ... its not necessary for the
  CCounter class to function properly ... nor does it use the
  CCounter class to actually perform its operation ...


// edit the second parameter of the below line ...
define('COUNTER_FILE', 'counter.dat');
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
       <title>Title here!</title>
<body bgcolor=#000000 text=#FFFFFF>
<h1>GearWorx Productions Counter Statistics</h1>
<table cellspacing=0 cellpadding=5 border=1>
= fopen('counter.dat', 'r');
$data = fread($fp, filesize('counter.dat'));
$data = explode("\n", $data);
$row = 1;
$data as $k=>$a) {
is_numeric(strpos($a, '|'))) {
$d = explode('|', $a);
$total += (int)trim($d[1]);
$d[1] > $top_int) {
$top_int = $d[1];
$top_chr = $d[0];
<tr bgcolor="<?=$row%2?'#666666':'#333333'?>">
<h4><?=$total?> total visits, from <?=$unique?> unique hosts</h4>
<?=$top_chr?> really likes visiting your site, with <?=$top_int?> visits.!