Web Templates
Web Templates  
Photoshop Layouts  
Flash Templates  
Templates Resource - Web Templates
   
 
  Sign UpPassword
Templates Resource Services Support Specials Members View Cart
 
  Photoshop Tutorials
  HTML Tutorials
  ASP Tutorials
  CSS Tutorials
  Javascript Tutorials
  PHP Tutorials
  XML Tutorials
  Flash Tutorials
  Fireworks Tutorials
  3D Studio Max Tutorials
  Cinema 4d Tutorials
  Graphics
  Website Tools
  Web Templates
  About Templates Resource
  Affiliates Program
  TR Support
  Webmaster Resources
 Columbia Tech Support

WebDesignHelper.co.uk


 

Tutorials: ASP - Active Server Pages

Number of Users Online

Intermediate

 

Show the Number of Users Online
Learn how to use global.asa to display the number of users visiting your site. This tutorial can be broken down into two sections, global.asa, and numvis.asp. Before you can begin this 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 the application.The global.asa file is often used to define and proccess session-specific variables, which is its function in this tutorial. Global.asa can not be written in ASP, so no tags in this file, here's the file:

<script language="vbscript" runat="server">
Sub Application_OnStart
Application("numvis")=0
End Sub
Sub Session_OnStart
Application.Lock
Application("numvis")=Application("numvis") + 1
Application.UnLock
End Sub
Sub Session_OnEnd
Application.Lock
Application("numvis")=Application("numvis") - 1
Application.UnLock
End Sub
</script>



English: whenever a user visits the site (triggering a session, Session_OnStart), the server adds one to the number of users, and whenever that user leaves (ending the session Session_OnEnd), the server subtracts one from the number of users. Application_OnStart applies 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.

 

This tutorial is provided to you by Spoono

More Tutorials
 

Active Server Pages Tutorials

AIM Screennames Viewer
This tutorial will show you how to make a script to see who has seen your AOL Instant Messenger profile.

Intermediate

Alternating Row Colors
Learn the basics of creating wonderfully abstract objects.

Intermediate

Browser Redirect
Learn how to do a Browser Redirect using the power of ASP.

Beginner

Cookies
Learn how to use cookies in ASP.

Intermediate

Counter
Learn how to make a hit counter in ASP.

Beginner

Database Connection
Learn the different ways to connect to different databases.

Intermediate

Database Insert
Learn how to insert a row into a MS Access database.

Beginner

Displaying Database
Learn a quick and easy way to display information from a database.

Beginner

Form Mail via CDONTS
Learn how to send mail using ASP and CDONTS

Intermediate

Form Mail via CDOSYS
Learn how to send mail using ASP and CDOSYS.

Intermediate

Number of Users Online
Use this code to display the number of users browsing.

Intermediate

Requests
Learn how to make use of requests.

Beginner

Sessions
Learn an alternative and effective solution to cookies in ASP using sessions.

Intermediate

String Functions
Learn the basic string functions available in ASP using VBScript

Beginner

XML Parsing
Use this nifty script to parse XML into HTML

Intermediate

Get help using .ASP here!

Get Free ASP Scripts here!

More Tutorials

Featured Web Templates

Web Template Preview 92311301

User Level:

Intermediate

Category:

Flash


Web Template Preview 92311401

User Level:

Intermediate

Category:

Flash



Web Template Preview 92311501

User Level:

Intermediate

Category:

Flash


Web Template Preview 92311701

User Level:

Intermediate

Category:

Flash


Web Template Preview 92311801

User Level:

Intermediate

Category:

Flash


Web Template Preview 92311901

User Level:

Intermediate

Category:

Flash


Web Template Preview 92312001

User Level:

Intermediate

Category:

Flash


Web Template Preview 92312101

User Level:

Intermediate

Category:

Flash


Web Template Preview 92312301

User Level:

Intermediate

Category:

Flash



Web Template Preview 92312401

User Level:

Intermediate

Category:

Flash

 

 

 

Templates Resource FAQ Services Terms of Use Site Map Support View Cart

© Copyright 2003-2008 Templates Resource