i have a counter script on my page (courtesy of david harrison) but when i try to implement it i get the following message:
[QUOTE]
Warning: array_rand() [function.array-rand]: First argument has to be an array in …/plugins/randomheader.php on line 41
any suggestions on what this might mean? line 41 ends up being one line in the array itself
[code=php]<?php
$count_file_path = “counter.txt”;
if( file_exists($count_file_path) ){
$count_file = fopen($count_file_path, “r”) or die(“”);
$curr_count = fgets($count_file);
fclose($count_file);
settype( $curr_count, “integer”);
$curr_count = abs($curr_count);
$curr_count++;
$count_file = fopen($count_file_path, “w”) or die(“”);
fwrite($count_file, $curr_count);
fclose($count_file);
} else {
$curr_count = false;
}
$phrases = array();
$phrases[sizeof($phrases)] = “Visitors have lost a collective.$curr_count IQ points by visiting this site.”;
$phrases[sizeof($phrases)] = “$curr_count people prefer McDonald’s to a lifetime of torture.”;
/* more phrases, etc.
the phrases take up lines 34-65
*/
$counter_phrase = ($curr_count) ? $phrases[mt_rand(0, sizeof($phrases)-1)] : “” ;
?>