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:
Cangzhou 2025-05-03 13:01:26
Dublin 2025-05-03 13:10:19
The Netherlands 2025-05-03 13:28:13
Paris 2025-05-03 18:08:41
Jakarta 2025-05-03 19:20:57
Suwon 2025-05-03 19:39:42
AppleBot 2025-05-03 21:36:30
Cheonan 2025-05-04 01:31:28
Mexico City 2025-05-04 01:41:31
Seychelles 2025-05-04 01:58:46
North Bergen 2025-05-04 02:15:18
Bulgaria 2025-05-04 06:18:36
Hong Kong 2025-05-04 06:29:10
France 2025-05-04 06:47:45
Boardman 2025-05-04 08:13:09
London 2025-05-04 09:42:28
San Francisco 2025-05-04 10:28:52
Amsterdam 2025-05-04 14:05:04
Helsinki 2025-05-04 21:22:58
China 2025-05-04 21:24:07
Los Angeles 2025-05-04 21:41:27
Moscow 2025-05-04 23:53:16
Colchester 2025-05-05 09:29:26
Manassas 2025-05-05 13:09:37
Bandar Seri Begawa 2025-05-05 13:46:48
SemRushBot 2025-05-05 18:49:21
Sweden 2025-05-05 20:23:07
Brno 2025-05-05 20:33:14
Düsseldorf 2025-05-06 01:08:11
YandexBot 2025-05-06 03:13:36
Ashburn 2025-05-06 04:31:50
BingBot 2025-05-06 05:08:59
Singapore 2025-05-06 06:27:54
Canada 2025-05-06 07:06:32
PetalBot 2025-05-06 08:40:43
San Antonio 2025-05-06 08:54:22
GoogleBot 2025-05-06 09:11:58
Columbus 2025-05-06 10:30:40
United States 2025-05-06 10:46:58