You need to set up either a session for every person or a cookie and have each time one is created stored in an array based on its user type. Then count each array's length for the total. Once it expires though you need to remove that index from the stack.