Forum Moderators: coopster
Hope you're both still around ;-)
I've been getting a bit stuck on this one, which page does this go on? and where would it go on the page please?
Try reformatting your php code and see what happens, like so
<?php $counterfile = 'counter.txt'; $phrasesfile = 'phrases.txt'; $multiple = 10; // Read in the value, trim off any newlines, and // convert it to an integer, // just in case: $text = intval(trim(@file_get_contents($counterfile))); // Update the file with the old value plus this hit: @file_put_contents($counterfile, $text += 1); // Is the value a multiple of 10? if ($text && $text % $multiple == 0) { // Read the phrases file into an array: $file = @file($phrasesfile); print 'Hey! It\'s visit #' . $text . '!<br />'; // Grab a random phrase from the file read in as an array: print $file[rand(0, count($file) - 1)] . '<br />'; }?>
Phrase for every 10 visits [webmasterworld.com]