Currently Online, how does that work?

I have had a few people ask me how I got that “currently online” thing on the bottom left of my page. As you can tell by all of my links, this site is entirely powered by PHP. I use a MySQL database to store all of my info, posts, links, boxes, session and cookie info, everything. For the Currently online box I made a table that is populated with IP addresses and the time the address was added. When anyone loads a page from my site I gather their IP address from the Header information and place it in the table. Then a little script looks to see how old the IP address is. If it is older than 10 minutes it deletes it. Then a simple record count of the table gives you the number of unique visitors in the past 10 minutes. It’s nothing special.


About this entry