count not working on clicking the link
<pre><code>$file = ".$dirN/$filename.";
                 $count_my_page = (".$dirname1/$filename.$extens");
        if(fopen(".$file.","r"))
        {
        $hits = file($count_my_page);
        $nHits = ((int) $hits[0]) + 1;
        $fp = fopen($count_my_page , "w");
        fputs($fp , $nHits . "");
        fclose($fp);
        echo $nHits;

         }
</code></pre>

<p>I want the count to increase only when i read the file, but it happens other wise on refreshing the page where the link of the file is present. </p>
