Hello, this is probabaly a simple question, I used the code posted by rob miller to make a rotating sig, and out of interest wrote a bit of code to increment a text file each time it was viewed so I could see how many times it had been viewed.
I looked a few days ago and the number was ~60,000, then I looked again today and it's now ~2,000...
The code I have is as follows:
I'm guessing it reset to zero when it incremented 65,535 if that would be the highest value for a 16 bit integer?
Unfortunately I don't have a great deal of experience with PHP, and was wondering if anyone can suggest a way to stop this happening?
I looked a few days ago and the number was ~60,000, then I looked again today and it's now ~2,000...
The code I have is as follows:
Code:
<?php
$files = glob('{*.PNG,*.png,*.JPG,*.jpg,*.GIF,*.gif}', GLOB_BRACE);
readfile($files[array_rand($files)]);
$count_my_page = ("hits.txt");
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
?>
I'm guessing it reset to zero when it incremented 65,535 if that would be the highest value for a 16 bit integer?
Unfortunately I don't have a great deal of experience with PHP, and was wondering if anyone can suggest a way to stop this happening?