there are several ways easiest is put a variable in application scope,increase it in every login and decrease it in every logout.