...

View Full Version : Ignore ip addresses in counter



Errica
03-13-2007, 05:10 PM
How can this be modified so that it will ignore a couple different ip addresses?



<?php
$counternum = "_counters/products.txt";
function displayCounter($counternum) {
$fp = fopen($counternum,rw);
$num = fgets($fp,99999);
fclose($fp);
$fp = fopen($counternum,w);
$num += 1;
print "<div style=\"color:#fff\">$num</div>";
fputs($fp, $num);
fclose($fp);
}
displayCounter($counternum);

?>

Fumigator
03-13-2007, 10:59 PM
Check the global variable $_SERVER['REMOTE_ADDR'] and bypass the function call if it matches the IP addresses you want to block.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum