PHP Counter
By
James Wright


PHP Counter uses PHP to keep track of the number of hits to your web site. PHP Counter is very basic and requires very little modification. PHP Counter has the ability to ignore hits from the owner by blocking the owner's IP address. PHP Counter can track numerous web pages (just include the counter code at the bottom of each page).


EXAMPLE


COUNTER
795



SOURCE CODE

// PHP Counter
// By James Wright
// http://www.mrjameswright.com/

// creates a file name to store the count number
$fileName = substr($_SERVER[’REQUEST_URI’].’cnt.php’, 1);
if ($fileName == ’cnt.php’)
$fileName = ’index.phpcnt.php’;

$f=@fopen($fileName, ’r+’);

$var = 1;

$num= @fgets($f, 999);

@fclose($f);

// The if statement prevents my computer from being included in the counter results
if ($ip != ’63.73.84.130’)
{
$f=@fopen($fileName, ’w+’);

$num = $var + $num;
fputs($f, $num);

@fclose ($f);
}

echo ’‹br›‹i›‹a href="http://www.mrjameswright.com/counter.php"›COUNTER‹/a›‹/i›‹center›‹b›‹i›’.$num.’‹/i›‹/b›’;




Home - Pics - Vidz - Programs - Jokes - Martial Arts - Links - Guestbook

Please email me at: JWright295@aol.com
Copyright © 2007  JWright295. All rights reserved.

Your IP address: 38.103.63.16
Browser: You are using:CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
Operating System: Mac/? FreeBSD/? OpenBSD/?
Your ISP: 38.103.63.16



COUNTER
795