I have a simple php script that is suppose to write the number of page loads into a txt file, it works fine, but it doesn't right ANYTHING into the txt file, it just keeps counting away even when there's no txt file on the server!!
Here is the code I am currently using:
Code: Select all
<?
$counter_file = ("hits.txt");
$visits = file($counter_file);
$visits[0]++;
$fp = fopen($counter_file , "w");
fputs($fp , "$visits[0]");
fclose($fp);
print $visits[0];
?>And there is currently NO txt file!