Show the Number of Users Online

Show the Number of Users OnlineLearn how to use global.asa to display thenumber of users visiting your site. This tutorial can be broken downinto two sections, global.asa, and numvis.asp. Before you can beginthis tutorial, make sure your host supports global.asa.

GLOBAL.ASA
Global.asa is defined as an optional file that defines functions,variables, and methods that are accessible by every ASP page within theapplication.The global.asa file is often used to define and proccesssession-specific variables, which is its function in this tutorial.Global.asa can not be written in ASP, so no <% %> tags in thisfile, here's the file:

<script language="vbscript" runat="server">Sub Application_OnStartApplication("numvis")=0End SubSub Session_OnStartApplication.LockApplication("numvis")=Application("numvis") + 1Application.UnLockEnd SubSub Session_OnEndApplication.LockApplication("numvis")=Application("numvis") - 1Application.UnLockEnd Sub</script>

English: whenever a user visits the site (triggering a session,Session_OnStart), the server adds one to the number of users, andwhenever that user leaves (ending the session Session_OnEnd), theserver subtracts one from the number of users. Application_OnStartapplies only to when the server is started.

NUMVIS.ASP
This file will display the number of visitors online like so:

<html><head><title>Spoono Rocks!</title></head><body>There are <%response.write(Application("numvis"))%>online now!</body></html>

Thats it! Put that code into your site or let it stand alone, and you'll be able to see how many visitors are at your site.

Related Articles

  • Page Navigation & Online Users & Chmod
    Many people have asked me how i got index2.php?page=link
    Basically what happens, is where ever the folllowing code is put on your main php page, is where the the page link.php will go.
  • Users Online
    First Run this SQL In your MYSQL database..
  • Blog and Podcast
    Podcasts and Weblogs were considered long time as niche medium. Two current studies show that the trends are further common at least in the USA as so far assumed.
  • All about SEO or SFO?
    First lets start with definitions:
    SEO: Search Engine Optimization, SFO: Search Friendly Optimization.
    These two things are what most webmasters have trouble balancing. These things seem to always be on opposite ends. On one hand you have to make sure search engines can crawll your website....
  • Should Your Join a Social Networking Website or Not?
    Social networking is defined as the grouping of individuals together into to specific groups, often like a small community or a neighborhood...
  • Top Website Navigation Tips
    The aim of a websites navigation is simply to allow users to get to the content they require. For sites that have a large number of sections and web pages (and information sites can be one of these) the navigation plan has to be properly researched and designed.
  • What is Pay-Per-Click (PPC) Marketing?
    Once your company has a professionally developed and functional web site, receiving web traffic becomes the next goal. There are many internet marketing techniques available today; Pay-Per-Click (PPC) Marketing is one of the quickest ways to begin an internet marketing campaign.
  • The Evolution Of Search Engine Marketing
    The world of search engine marketing (SEM) is in constant evolution. With increased numbers of search engines, and evolution in the techniques and technologies used, SEM is becoming a tool industries cannot afford to do without.
  • Detect a Users Language
    Show something like Language: *Your Language*
  • Ten Fatal Mistakes That Make Web Sites Stink
    Since youll spend lots of time and money to create your web site, dont you want to make sure youre not making mistakes that at best irritate users, and at worst make you lose customers? After all, when you alienate users, you lose potential revenue. Who can afford that?

Contact Web Design Outsource and get started today

Need Website Designing, Development, Redesigning, Maintenance and SEO services or help growing your company's web presence? Request a free Quote Now.