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.
Error:
Parse error: syntax error, unexpected '[' in /home2/whackand/public_html/blog/index.php on line 21
I would recommend using a analytics program instead. It will give you more information and will help you market your website. It is not a good idea to display the 'hits' your website has, but if you really want this feature with Google Analytics you can also export this data to a web page give you features of analytics and easy export of the data you want.
Thanks for the idea about Google Analytics. I thought about using it but I just wanted something basic plus I have never coded something like that so I wanted to gain some experience.
I will look into it. Also the echo's were just error checking trying to figure out what was wrong I am not actually going to display it.
Thanks for the new code, I am going to look at it and figure out where I went wrong.
Bookmarks