I am trying to get a unique hit counter working based on IP addresses as it's the only way I can think of identifying unique users.
Basically what i am doing is taking the ip they view the page with and checking it against a file that includes a list of all the other ip's that have viewed the page. If the new ip isn't listed it is added to the file and the number of hits is incremented by 1.
I am having trouble getting the while loop to run through the file of ip addresses. the error and code follow, the error occurs in the while statement.
Parse error: syntax error, unexpected '[' in /home2/whackand/public_html/blog/index.php on line 21
/* This is not part of the script
if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') == true)
$ip = $_SERVER['REMOTE_ADDR'];
$ip_log = ("ip_log.txt");
$ip_log_array = file($ip_log);
$fp_ip = fopen($ip_log, "r+");
$i = 0;
while(ip_log_array[$i] != feof($fp_ip))
if($ip != $ip_log_array[$i])
$hit_counter = ("hits.txt");
$hits = file($hit_counter);
$fp = fopen($hit_counter, "w");
Thanks for any help you can offer.