I'm building a website in which I want to match events (concerts, fun thing to do in the area, etc.) to users. These events should be constrained to a location on either a country, state or city level. For example, one event might only be interesting to people who live inside one city, whereas another event might be interesting to anybody in the same country (for big events).
However, these events should be listed in order of popularity (which will be a guess based on the number of comments and clicks). Finally, there should be a random factor involved to prevent the person from seeing the same events every time.
Note that the results don't have to be exact, a good heuristic is fine.
1. What are some good algorithms for this purpose?
2. Is there any application I can use to do this efficiently?
I prefer it to be extendible: I'd rather not have to re-write everything should I want to add some matching-parameters in the future.
So far I'm using only PHP/MySQL, though I'm not sure if that's enough to do this efficiently.
Thanks in advance