Keeping it real

While I haven't been paid to write computer programs since 1993, I've always found that maintaining an interest in coding technology and platforms (among other things) has offered great benefits when dealing with developers and especially when debunking IT suppliers' FUD and nonsense. So here's a small hobby project that ticked a number of interesting boxes in 2008 - open source, PHP, JavaScript, web services and geolocation.

world mapHave you come far?

Since I started building hobby web sites in the late 1990's I've had an interest in who visits my sites and how they find their way to them. Since Google Analytics came along it's been easy for webmasters to track this, but one thing that's lacking from an otherwise impressive package is the ability to publish visitor information back to the website itself.

What's so great about open source?

When establishing Cogitant in 2008, I built this quick and simple website with Joomla. Joomla is a free, open-source PHP-based content management system using the similarly free mySQL database. WordPress is a more popular choice for building blog-style sites but I liked the additional flexibility in structure offered by Joomla. Like many open-source frameworks it is designed to be extensible via user-written modules.  A great many have been written and shared - some under free-to-use open-source licenses like GPL, others under commercial licenses.

Standing on the shoulders of ... PHP programmers

Another great advantage of open source software is that as a developer you can easily and legitimately re-use and extend existing functionality and code. My starting point for building a "where are site visitors located" add-on was the built-in Joomla module whosonline which displays how many users are logged on. This provided the structure for my new Joomla module along with working example of how to access the database, display results etc. Joomla has had a few significant structural upgrades since 2008, but in each case it was quite easy to update the modules based on later versions of whosonline. The google maps API has also undergone some changes, but the concept of API versioning at least allows an orderly transition.

I built my geolocation solution as two Joomla modules. One uses a web service (geoplugin.com) to determine approximate location - to the nearest town or country only, based on IP subnet address - and adds this to the site database. The other reads recent locations from the database and uses the Google Maps API to plot approximate locations on a map. Click on the Recent Visitors link on the main menu to see the results.

Yeah whatever. My toaster has geolocation now

The world of location-based services has certainly come a long way, even since I built this add-in in 2008. But while IP-based geolocation is approximate and unreliable, it fits this purpose very well. It doesn't capture or record any more information than is needed for my purpose, which is both efficient and helpful from a data privacy standpoint. It's true modern browsers support accurate location methods via GPS and other dark magic, but these methods return much more precision than we need here, and quite rightly require explicit user consent.

Popular in Russia?

If you are puzzled by the regular visits from distant lands including China, Turkey and Russia, this is where many script-based attacks on websites originate, looking for a weakness that would allow the attacker to take control of the site.  Safe to say that every day someone is trying to break into any internet-connected device you have, so keep those patch levels up to date!

Recent visitors:
North Charleston 2025-04-23 08:38:17
Amsterdam 2025-04-23 09:56:17
Scottsdale 2025-04-23 11:15:37
Dublin 2025-04-23 13:02:02
Singapore 2025-04-23 13:23:21
AppleBot 2025-04-23 15:41:09
Stockholm 2025-04-24 03:07:48
Hong Kong 2025-04-24 03:47:38
Phoenix 2025-04-24 04:25:11
Ashburn 2025-04-24 04:31:15
Rümlang 2025-04-24 06:05:55
China 2025-04-24 06:52:58
Mumbai 2025-04-24 08:33:12
Mexico City 2025-04-24 08:35:37
San Jose 2025-04-24 08:37:30
Santa Clara 2025-04-24 10:48:04
San Diego 2025-04-24 11:09:35
Clifton 2025-04-24 12:51:03
United States 2025-04-24 13:53:03
Sterling 2025-04-24 15:44:49
Midrand 2025-04-24 17:30:19
PetalBot 2025-04-24 18:32:32
Toronto 2025-04-24 20:02:14
Bulgaria 2025-04-24 21:19:17
BingBot 2025-04-25 00:10:47
London 2025-04-25 01:20:18
Vietnam 2025-04-25 01:25:49
YandexBot 2025-04-25 03:19:55
Slough 2025-04-25 05:38:24
Columbus 2025-04-25 06:47:15
GoogleBot 2025-04-25 07:44:50
Jersey City 2025-04-25 10:40:32
Canada 2025-04-25 11:55:36