RunarM
Finally back
I want to add a counter to my website, how do i do that?
here is my Counter.php
and here is the Counter.txt:
here is my Counter.php
PHP:
<?
$file = "counter.txt";
if (!file_exists($file))
{
touch($file);
$handle = fopen($file, 'r+');
$str = "<? \$count=0 ?>";
}
else
{
include "counter.txt";
$count++;
$str = "<? \$count=".$count." ?>";
$handle = fopen ($file, 'r+');
}
fwrite($handle, $str);
fclose($handle);
echo 'Views: ';
echo $count;
?>
and here is the Counter.txt:
Code:
<? $count=0 ?>