<?php
$file = "counts.html";

    if ( is_file( $file )==false )  {touch($file);$open = fopen($file, "w");fwrite($open, "0");fclose($open);}

//read counts
$open = fopen($file, "r");
$count = fread($open, filesize($file));
fclose($open);

//if cookie isn't already set,then increase counts by one + save ip, and set a cookie to pc...
$cookie_namee='mycounterr-456';
    if (!isset($_COOKIE[$cookie_namee])) {
    $open = fopen($file, "w");
    $count++;
    fwrite($open, $count);
    fclose($open);
    setcookie($cookie_namee,"Checked",time()+111400);
    }

//uncomment the below line to see the visits number on page
//echo $count;
?>