$dirname1 = '../counters';
$dirN = '../uploads';
$extens = ".txt";
$fh = fopen(".$dirname1/$filename.$extens", "w");
if(fopen(".$dirN/$filename.", "r")) {
$count_my_page = (".$dirname1/$filename.$extens");
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
echo $hits[0];
}
each time i open the file, the count should be updated.... but it happens only for the first time.....