quote:
Originally posted by traxor
Does anybody know how I can use Awstats to make a hit counter, I want it a text hit counter on my site, showing the "Hits" that I have received.
Not unique .
=/ why are you all making normal file based ones insted of ones that fetch their data from "awstats"
quote:
Originally posted by Stigmata
<?PHP
$file="hitscount.dat";
$handle=fopen($file, "r+");
$hits=fread($handle,filesize("$file"));
$hits+=1;
fclose($handle);
$handle=fopen($file, "w");
fwrite($handle, $hits);
fclose($handle);
?>
=/ why do you use r+ if your just going to read from it , you should just use r then open the file with w place your data and close it. OR use w+ read from the file then write to it and close the file like so...
code:
<?php
$file="hitscount.dat";
$handle=fopen($file, "w+");
$hits=fread($handle,filesize("$file"));
$hits++;
fwrite($handle, $hits);
fclose($handle);
?>
Really not the best code because of no error checking but eh...