Simple Hit Counter Example
Hit counters are valuable because they allow site visitors to see how many people visited or used a server-based tool.
This is a very simple implementation of a counter. You can see it run at the link above.
The counter code is in the back-end/server-side logic.
PHP5 version
$iCount=file_get_contents('count.txt');
file_put_contents('count.txt',$iCount+1);
echo '<p><span style="font-weight:bolder;border:1px solid #000;padding:2px;">'.$iCount.' gradients created.</span></p>';
PHP4 version
$iCount=file_get_contents('tri.count.txt');
$fp=fopen('tri.count.txt','w+');
fwrite($fp,$iCount+1);
fclose($fp);
echo '<p>'.$iCount.' downloads</p>';
Print article | This entry was posted by elvis on 04/18/09 at 07:47:13 am . Follow any responses to this post through RSS 2.0. |