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:
Mexico 2024-05-07 09:59:38
Kyiv 2024-05-07 10:02:21
YandexBot 2024-05-07 12:39:03
Hong Kong 2024-05-07 14:47:57
Linz 2024-05-07 15:56:44
Bengaluru 2024-05-07 17:43:54
Dnipro 2024-05-07 21:54:34
AppleBot 2024-05-07 22:51:49
Columbus 2024-05-08 04:02:30
Washington 2024-05-08 06:55:50
Lahore 2024-05-08 07:50:47
Montreal 2024-05-08 08:50:20
Guildford 2024-05-08 09:23:23
Sweden 2024-05-08 12:22:38
Düsseldorf 2024-05-08 13:45:50
London 2024-05-08 16:06:19
BingBot 2024-05-08 16:45:56
Ashburn 2024-05-08 18:54:57
Johannesburg 2024-05-08 20:33:55
Brussels 2024-05-08 20:55:58
Mexico City 2024-05-08 22:06:42
France 2024-05-08 22:32:59
Overland Park 2024-05-09 00:16:43
Dresden 2024-05-09 00:19:03
Singapore 2024-05-09 02:28:44
Vienna 2024-05-09 03:59:46
Bulgaria 2024-05-09 06:00:59
PetalBot 2024-05-09 06:33:54
ZoomInfoBot 2024-05-09 07:15:07
GoogleBot 2024-05-09 07:30:26
Eitensheim 2024-05-09 08:30:09
Council Bluffs 2024-05-09 10:18:28
United States 2024-05-09 10:39:18
Boardman 2024-05-09 10:44:15
The Netherlands 2024-05-09 13:44:58
Canada 2024-05-09 13:57:38