/ Published in: PHP
Though an old post, this is my solution that's been pieced together from various comments on the article linked above.
URL: http://mobiforge.com/developing/story/lightweight-device-detection-php
URL: http://mobiforge.com/developing/story/lightweight-device-detection-php