CoverYourASP --> Administering the Application variables

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
9 active users
2301 visitors today
2002 pages today
(only part of today)
Tools I use

Copyright © 1999-2016 James Shaw.
All rights reserved.

RSS submissions

Now open source with SourceForge!

Much of the content on the site is read from the database once a day, and stored in Application variables for efficiency. Banners are a good example, as documented in this related article.

Recently a few people have asked about how I reset these variables when I add a new affiliate site button or advertiser banner, so I thought I'd write it all down here.

What's the problem again?

As you probably know by now, I administer my database online using these pages, but after new data has been added to the relevant table it won't automatically show up on the site because the data is served from Application variables - a cache effectively - using code like that shown below:

// put data from database in cache once a day
Application ( 'Banner' ) = '' + oRecordSet ( 'BannerHTML' );


// display cached HTML on page
Out ( Application ( 'Banner' ) );

Rather than waiting until midnight for the cache to be updated I needed a way to update it immediately. (Note: this isn't at all complicated, but it may help you re-use my code since this isn't documented anywhere else)

Refreshing Banners

The most common thing I want to do is refresh the banners and buttons after I've added one. To do that I simply call my ResetBanners.asp page (with my password appended to the URL). The guts of this page are shown below:

// get password from URL
LookForMagicWord ( );

// if the correct password was given..
if ( bValidUser )
   // ..refresh the banner cache
   GetDaysBanners ( );

// go to front page
Redirect ( '/default.html' );

Very simple - I just make sure it's me calling the page, then call the same function GetDaysBanners as is called at midnight by the BrandNewday function. It's not rocket science, but now you know.

Refreshing other variables

Here is the complete list of "admin" pages:
To do this
Refresh banners from databaseResetBanners.asp
Resend Unconfirmed Members emailsResetMembers.asp
Refresh newsletter archives from file systemResetNews.asp
Refresh everything (as at midnight)BrandNewDay.asp

Featured sponsor
My favorite resources

CoverYourASP Mugs, T-shirts, caps - even Boxer shorts...
I don't make a penny from these, but they're a lot of fun! Don't you need a new mouse mat?

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!