Web Site Counter?

Well i need to add website counter, and i was wondering if anyone would recommend any of the freeware counters avaliable out there or even a link to some tutorials regarding php counters???

all comments or suggestions are welcome :slight_smile:

-AlBERT

PHP and MySQL

create table : counter ( id int(6), ip varchar(20), time varchar(40) )
create table : total ( view int(6) )
exp
<?php
require (“db.php”); // copy from includes/db.php of phpbb forum
function counter () {
global $db; // I uses my_sql class from phpbb
$time_refresh = 5*60; // 5 mins
$ip = $_SERVER[“REMOTE_ADDR”];//get ip browser
$past = time()-$time_refresh;
$sql = “DELETE FROM counter WHERE time < $past”;
$db->sql_query($sql);
$sql = “SELECT time FROM counter WHERE ip=’$ip’”;
$result = $db->sql_query($sql);
$exist = $db->sql_numrows($result);
if($exist == 0) {
$sql = "UPDATE total SET view=view+1;
$db->sql_query($sql);
}
}
$sql = “SELECT view FROM total”;
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$visit = $row[view];
echo “there are “.$visit.” visitors”;
?>

um, bravenet.com ??? hehe…

make a file called counter.php and put:

<?php
$count_my_page = (“hitcounter.txt”);
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , “w”);
fputs($fp , “$hits[0]”);
fclose($fp);
echo $hits[0];
?>

Next you must make a file to include that function by:
<?php
include (“counter.php4”);
?>

then make a blank text file called hitcounter.txt and chmod the permissions to 777.

this is not a unique ip counter… it will add +1 everytime you refresh the page.

hope this helps.