To make this work on a single page you will need to create/modify 4
files.
So here goes...
Create a file called counter.php and put following code in it:
<?php
//Counter
$count_my_page = ("hitcounter.tx t");
$hits = file($count_my_ page);
$hits[0] ++;
$hit_count = $hits[0];
$fp = fopen($count_my _page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
//echo $hits[0];
//Details to add to list
$count_my_page = ("hitcounter.cs v");
$fp = fopen($count_my _page , "a");
$ip=$_SERVER[REMOTE_ADDR];
$dnsname = gethostbyaddr($ ip);
$referer=$_SERV ER[HTTP_REFERER];
$page=$_SERVER[PHP_SELF];
$now = date( "Y/m/d H:i:s", time() );
fputs($fp , "$now,$hit_coun t,$page,$ip,$dn sname,$referer\ r\n");
fclose($fp);
?>
Then create a file called hitcounter.txt and put value 0 in it.
Then create a file called hitcounter.csv and put following text in it:
TimeStamp,Count ,Page,IP-Adress,DNS,Refe rer
Remember to give write permitions to the hitcounter files for your
local internet account and you done.
Now on every PHP web page you have add the following code between the
<header></headeror <body></bodytags:
<?php include ("counter.php") ; ?>
If you link .csv file to excel when you click on the csv file you will
be promted to open it with excel.
If you do you get a nice grid layout of the data.
files.
So here goes...
Create a file called counter.php and put following code in it:
<?php
//Counter
$count_my_page = ("hitcounter.tx t");
$hits = file($count_my_ page);
$hits[0] ++;
$hit_count = $hits[0];
$fp = fopen($count_my _page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
//echo $hits[0];
//Details to add to list
$count_my_page = ("hitcounter.cs v");
$fp = fopen($count_my _page , "a");
$ip=$_SERVER[REMOTE_ADDR];
$dnsname = gethostbyaddr($ ip);
$referer=$_SERV ER[HTTP_REFERER];
$page=$_SERVER[PHP_SELF];
$now = date( "Y/m/d H:i:s", time() );
fputs($fp , "$now,$hit_coun t,$page,$ip,$dn sname,$referer\ r\n");
fclose($fp);
?>
Then create a file called hitcounter.txt and put value 0 in it.
Then create a file called hitcounter.csv and put following text in it:
TimeStamp,Count ,Page,IP-Adress,DNS,Refe rer
Remember to give write permitions to the hitcounter files for your
local internet account and you done.
Now on every PHP web page you have add the following code between the
<header></headeror <body></bodytags:
<?php include ("counter.php") ; ?>
If you link .csv file to excel when you click on the csv file you will
be promted to open it with excel.
If you do you get a nice grid layout of the data.
Comment