I've uploaded the snippet to mudbytes as well, pending approval (and removed the connection restrictions).
The MUD uses MySQL to insert all connected players, with IP addresses and some other bits of information (level, account name, player name), into a database. When they log off, it removes them. The PHP scripts merely log into the MySQL database and compare the IP of the person viewing the website to that saved in the database. When the MUD boots up, it clears the table to eliminate any inconsistencies involved in a crash.
In the past, we had a similar system, but involving writing all descriptors to a file and then reading from it with PHP.