Hi Ryan,
there should be many threads on this topic, and probably quite some tutorials and readymade scripts available, too.
Anyway, the idea behind it should be pretty similar:
Update the timestamp whenever a page is requested.
Since you can't know when a user leaves your site, you'd need to decide after what time of inactivity you want to consider him or her gone.
Then "online users" are those that have a timestamp between now and now minus the period of time you have set.
Hope this helps.