How do i determine how many current users are on the site?

Posted on 2005-03-16
Medium Priority
Last Modified: 2010-04-07
I simply want to find out how many users are currently browsing the site.  Any ideas..?

Thanx in advance...
Question by:hugeeuge
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 13561599
Are you using an ASP or PHP server?  If so, then its possible to do this.

Author Comment

ID: 13562140
I am using Coldfusion...
LVL 25

Accepted Solution

James Rodgers earned 400 total points
ID: 13590911
i use this in an iframe on the pages i want teh count to appear

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

            <meta http-equiv="Refresh" content="20;URL=#RELLOCPATH#users.cfm">
            <link rel="stylesheet" href="#RELLOCPATH#commonFiles/mainstyle.css" type="text/css">


                  <cfsetting enablecfoutputonly="Yes">
                        <cflock timeout="15" scope="APPLICATION" type="EXCLUSIVE">
                              <cfif NOT isDefined("Application.UsersInfo")>
                                    <cfset Application.UsersInfo = StructNew()>
                        <cflock name="#CreateUUID()#" timeout="15" type="EXCLUSIVE">
                              <cfset user_cfid = Evaluate(CFID)>
                              <cfset user_info = Now()>
                        <cflock scope="APPLICATION" type="EXCLUSIVE" timeout="15">
                              <cfif NOT StructKeyExists(Application.UsersInfo, user_cfid)>
                                    <cfset temp = StructInsert(Application.UsersInfo, user_cfid, user_info)>
                        <! --- // Ok now, we have to create a way to delete them so they don't stay in the list forever, I'm going to use a 10 minutes difference, to expire the user, remember this code should be in your application.cfm or included in your application.cfm, we are going to use the DateDiff to find out if the structure should be deleted. //--->
                        <cflock scope="APPLICATION" type="EXCLUSIVE" timeout="15">
                              <cfloop collection="#Application.UsersInfo#" item="itmUser">
                                    <cfif Evaluate(DateDiff("n", StructFind(Application.UsersInfo, itmUser), Now())) GT 10>
                                          <cfset StructDelete(Application.UsersInfo, itmUser)>
                        <cflock scope="APPLICATION" type="EXCLUSIVE" timeout="15">
                                    <cfif #StructCount(Application.UsersInfo)# EQ 1>
                                          There is #StructCount(Application.UsersInfo)# user
                                          There are #StructCount(Application.UsersInfo)# users
                                    on the system.
                  <cfsetting enablecfoutputonly="NO">
LVL 25

Expert Comment

by:James Rodgers
ID: 13920393
glad i could help

thanks for the points

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question