MySQL category archive

View live site referers

September 6th, 2005 | Filed under PHP, MySQL, Essential Tools, Traffic stats

Programmer Dean Allen’s free PHP/MySQL app, Refer, displays live real-time referring URLs to your web site.

Of course, one could just watch one’s site logs to get an idea of who’s clicking in from where. But Refer filters out certain types of files (CSS, JS, etc), referers from your own domain, and can exclude certain directories, too. (Like, I don’t want to see any referers generated while I’m working on a post in WordPress.)

I’ve used Refer for several months now on my other site, and besides occassional referer spam problems, it’s a fantastic way to see immediately if your site is getting a whole lot of traffic from fresh links.

The downside of Refer is that it requires a database insert on EVERY request for pages for which you want referers recorded. This can slow things down considerably, and perhaps give your conservative performance-concerned sysadmin indigestion. Refer uses this neat .htaccess line which automatically adds the PHP script to the end of each page for processing:

php_value auto_prepend_file /www/ginatrapani/refer/refer.php

Not sure how long I’ll keep this unpassworded, but here’s Spun’s installation of Refer so you can check out how it works yourself..

Refer 2.1 [Textism]

iTunes Library reports

August 31st, 2005 | Filed under PHP, Code snippets, XML, MySQL

Developer Alex King’s released a PHP/MySQL app that imports your iTunes library and displays reports like your top rated artists based on number of songs.

The code imports iTunes’ Library.xml into 3 MySQL tables using PHP 5’s XML libraries, like this:

Even Alex says that’s “an ugly hack.” What’s the better way to handle it without the output buffering?

Either way, I’ve posted my iTunes library reports using Alex’s app.

alexking.org: Blog > iTunes Stats [Alex King]