I used MySQL. A flatfile system should work fine aswell (don't see any disadvantage unless the load becomes very high). I chose to go with MySQL because I knew SQL but not php at that time, so this seemed the easyest. I still think building SQL queries is easyer than "file fidling".

You should store the datetime in a column and remove those rows who where created more than x seconds/minutes ago, where x is either a static number or a setting that the client can be set within some range by the client. There are datetime compare functions in SQL databases, but for your flatfile system I would just use the system time and count seconds/minutes.

The problem is probably WHEN to do this removal. To always get an up to date list, you must remove all outdated rows before retrieval. In your case, you'll have to check all the rows and remove all outdated ones and then return the rest.

If you expect a very high load on this server, a more efficient but less accurate solution is to only remove rows once every x retrievals (use a counter). You can probably also remove outdated rows periodically, without client interaction but I don't know how.

To improve on this system, you could add a php file that removes a certain client at any given time and let the game server (not the central server) call this when it cancels the game. This does raise security concerns (anyone can use this php file, even from a browser, with any parameters) so you might want to add a random password that is decided by the game server when it joins.

You could also add a way to 'report' crashed/disconnected game servers. If you try to connect to a server from the list and it doesn't work, report that to the central server. The central server checks if it indeed can't connected and removes it if it really crashed/disconnected.

Good luck