Count the visitor of website

Count the visitor of website

am 29.09.2007 04:36:27 von dev

Dear All,
i have get combination of four PHP script for count the visitor of
website but when i apply all these i have no answer.
i am posting the code of all four PHP script below.

CODE OF INDEX.PHP

print "";

If (file_exists( "counter.txt" )){
include_once "read.php";

$count++;

echo "This page has been visited $count times";

include_once "write.php";
} else {
print "Error: Cannot find Counter Data File!
";
}

print "
";

?>


CODE OF COUNT.PHP

print "";

If (file_exists( "counter.txt" )){
include_once "read.php";

$count++;

include_once "write.php";
} else {
print "Error: Cannot find Counter Data File!
";
}

print "
";

?>

CODE OF READ.PHP
$file = "counter.txt";

$open = fopen( $file, "r" );
$count = fread ( $open, filesize ( $file ) );
fclose( $open );
?>

CODE OF WRITE.PHP
$file = "counter.txt";

$open = fopen( $file, "w" );
fwrite( $open, $count );
fclose( $open );
?>

THERE IS ONE FILE ALSO NAMED COUNTER.TXT HAVING 0

any body help me to apply these correctly because i am new to PHP.
Please tell me
1. correct location of each script in my index.html page
2. any extra code (if any) for the index.html page.

thanks in advance.

Dev