bga89031 wrote:well, to be frank, i can't.
It would be interesting to know why. Many issues that might appear to be obstructions may have already been circumvented.
But I can see a problem in your logic:
$file = file("stats.txt");
//...
if (file_exists('stats.txt'))
So you read the entire file, and then check to see if it exists. If the file does exist, you do this
$param[1]++;
$fil = fopen('stats.txt', r);
echo $param[1]+1;
fclose($fil);
$fil = fopen('stats.txt', w);
fwrite($fil, implode(",", $param));
fclose($fil);
You increment a variable, open a file, echo the variable (plus one), close the file (without having done anything with it), open the file again, overwrite what was in there, then close the file again.
What you'll need to do is read in the whole file into an array (you're doing that, putting the result in $file, but you're not doing anything with it), change the line in the array you want to change, then write the whole array back out again (instead of just some miscellaneous bits and pieces).