Look in the index.php file of your vBulletin site. There should be a section which is commented something like "Online Users" or "Whats going on", there is code there that you could modify slighty and just use that.
Basically this is what it does:
- Fetches rows from the session table that are within the cut-off time (TIMENOW - 1hr(in secs)?)
- Counts total vistors
- Checks if userid == 0, (if it does then the user is a guest, otherwise the user is member)
- Increments seperate counters for member and guest count.