Alright, I feel as though I spoke rather harshly. The script you demonstrate certainly shows a lot of skill. But if you're able to create that, and if you truly understand exactly what you've written there, I must ask: why aren't you able to come up with some of these answers on your own? When I want to make a script, I don't log onto this board or any other and say, "how do I do this??", I sit with a pen and paper or with my PHP editor and think about it until some ideas come to me, or I go to Google to and see if someone's already done just what I want to do (unless my purpose is specifically to learn how to do something). Then, later on, if I have more specific questions, I refer to the documentation, Google, the archives of this forum, and if I still don't have an answer, then I ask the question.
So think of it this way: You want to write a script that will tell you which members are online. How can you do this? What do you know about the users, or what can you find out about them? Can you find out if they are connected right now? Well, HTTP doesn't quite work that way -- once a user finishes downloading the current page, they are disconnected immediately. So how do we solve this? Sounds like a sessions problem to me. If you think about it for awhile, I think you can answer some of these questions. Or you can go to Google.