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, geolocation and mashups.

world mapHave you travelled 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 one significant structural upgrade since 2008, but it was quite easy to transplant my unique code back into a version of the new standard whoseonline module structure.

I built my geolocation solution as two Joomla modules. One uses a web service ( 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!