Whos Online City & State Add-on Script

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.

You can see it working at http://jcweather.us/whos-online.php?refresh=60&bots=show (pw mchallis for awhile) and download it at http://jcweather.us/whosonline/info-sniper.zip.

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.

Happy New Year - Jim

Gave it a go.

I saw one error because of

require_once ‘./whosonline/isnipe_config.php’;
I had no folder named whosonline. I fixed that but this new error is beyond me.
Fatal error: Cannot instantiate non-existent class: simplexmlelement in isnipe_include.php on line 75

Looks like a cool addition to a great script.

Mark

Mark,

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.

Thanks. - Jim

k

Thanks
Mark

Hi Jim

I get an error too.

I look forward to see the addition to the script.

Thanks.

Best regards,

Henrik

Hi again Jim

I see the script running at your site now - I will have a go for it tomorrow.

Thank you very much.

Best regards,

Henrik

Ps. here is my info:

You ~ Tele, DK (Tele is a part of the name of my ISP - I guess city names dont work for Denmark?)

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. :frowning:

  • Jim

Thanks for the try :slight_smile:

Mark

Hi Jim,

Great script, works for me :smiley:

Nice script. My location reports as Carbondale, IL but I’m in Maryland. All other info seems to be accurate.

–Dave

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.

Stuart

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.

Sorry for the problems. - Jim

Works great, thank you.

This file is called (isnipe_config2.php) but I removed the 2 and it seemed to be ok.

Thanks for the cool script
Mark

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).

  • Jim

Hi Jim

Thanks - now I understand why Silkeborg showing up on your page :smiley:

Best regards,

Henrik

Hi again Jim

I have it up and running - both in Danish and English.

Thank you very much for the add-on.

Best regards,

Henrik

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.

Wish me luck. This will be my new years day project :lol:

Hi again Jim

I have a problem.

When im logged out - I see the city name - but when im logged in it dissapears.

What can be the problem?

See attached pics

Best regards,

Henrik


Zalmor,

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?

  • Jim