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' ); |
|