Mike Challis’ Whos Online Script http://discourse.weather-watch.com/p/282902 has been a big hit and he’s done a great job with it, but the country flag looked a little lonely to me. I was also tired of manually entering location info into the array that Henrik & Henkka introduced to us.
With a one line addition to Mike’s include-whos-online-page.php file, this add-on script will look up location information for each IP and add the City and State right after the county flag. Where city information isn’t available, it’ll use provider info and country. The information comes from infosniper.net which allows you 30 free XML lookups per day. This add-on stores lookups in a mysql table so IPs don’t have to be looked up a second time. Geolocation by IP isn’t very accurate, but it does seem to give a pretty good approximation in most cases and InfoSniper seems to be the best of the free services.
This is my first experience with MySQL but I was able to learn a lot using Mike’s great script as a learning tool. Please let me know if you have any problems and I’ll try to fix them.
The first problem was my fault because I have those files in a \whoseonline\ folder and forgot to remove that from the script. For the second problem, try removing the word “new” on line 75 and let’s see if that will work for you. That doesn’t work, we’ll have to look further into that function.
Sorry folks, guess the script is on hold until I read the XML a different way. Works for me, but not for the first two others so that’s not a good sign.
I notice that a lot of UK IP’s say London or just UK irrespective of where people are in the UK. I think all it says (for UK ISP’s anyway) is where the ISP’s registered their location. Looks good for the USA but not much additional information for the UK in a lot of cases because most ISP’s cover the whole UK.
I’ve changed the method of parsing the XML so hopefully it will work for everyone now. The .zip file in the original post has that change which only affects isnipe_include.php.
My location is also off, I think because they report the Verizon hub office rather than my small town. When actual location is known, you can go into your phpMyAdmin and update the city. I think I’ll do that for Henrik now since I know which one he is.
Thanks for the feedback Mark, I’m glad it’s working for you now. Too many versions running around here and time to clean up. I fixed that up in the .zip file (again).
Got it up and running.
But when I go into phpMyAdmin, I’ve got ‘No index defined!’ in a yellow box for the following tables showing:
country_info
location_info
query_info
I’m a newbie to phpMyAdmin also where as checking/correcting tables and stuff.
Which fields should the index(s) be created on for each table? The country flag is showing unknown, l believe this is caused by the index not being defined.
There is no index created for location_info or query_info, and I see the same message. The country_info is part of Mike’s add-on and from what I can see, that is created w/o index too. For the country flags not being shown, best to post over on the original thread so Mike can help?