This is a little light on comments, but there's not much source to read. It's also a little light on organization.
This is just a quick demo I threw together to find out how using the geonames geocoding API works.
It filters a list of sample users I generated based on proximity to a user supplied location.
Demo is here.