Wife/Girlfriend/Sister?
Pepper Spray &
Stun Gun Specials!
KEEP THEM SAFE.
 CoverYourASP --> Application variables --> Part 4

Free membership

Join in the fun! Sign in
Member Services

Site navigation
Download the entire site!
Search my articles
Free Magazines
Browse the directory

Send me feedback
Buy my boxer shorts

Recommend this page
Printer-friendly page

Resources I recommend
Link to my site
Advertising slashed!
About your privacy
Legal stuff
Site statistics
49 active users
512 visitors today
1155 pages today
how is this done?
Tools I use

CoverYourASP
Copyright © 1999-2010 James Shaw.
All rights reserved.

ASP.NET Blog
RSS submissions
E-commerce

Now open source with SourceForge!

Then to display the data in the header of every page I use this code in utils/Header.asp:

// lock the application so I can increment page counter
Application.Lock ( );
Application ( 'PagesToday' )++;
Application.Unlock ( );

// display the data
var nUsers = Application ( 'ActiveUsers' ) - 0;
var nUsersToday = Application ( 'UsersToday' ) - 0;
var nPagesToday = Application ( 'PagesToday' ) - 0;
var bRebootToday = Application ( 'NewToday' ) - 0;

Out ( nUsers + ' active user' + ( (nUsers==1) ? '!' : 's' ) + '<br>' );
Out ( nUsersToday + ' visitor' + ( (nUsersToday==1) ? '' : 's' ) + ' today<br>' );
Out ( nPagesToday + ' page' + ( (nPagesToday==1) ? '' : 's' ) + ' today<br>' );

Out ( '<a href="Application.asp">' );

if ( bRebootToday )
   Out ( '(only part of today)' );
else
   Out ( 'how is this done?' );

Incidentally, for those of you not familiar with C or JavaScript, the "?:" syntax in the source code...

Response.Write ( (nUsers==1) ? '!' : 's' );

...is shorthand for writing this:

if ( nUsers == 1 )
   Response.Write ( '!' );
else
   Response.Write ( 's' );

Featured sponsor
My favorite resources

Tiki Statues - Tiki Masks - Tiki Totems



New Proposal Kit Professional 5.1
Brand yourself as a top professional: create quotes and amazing proposals and get many legal documents free!

The latter saved me 3 times the purchase price on the first day I owned it!


Qualify for Free Trade Magazines

Free subscriptions to industry leading publications for those who qualify!