Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 24,400 times

Contents

Related Categories

Managing banner ad clickthroughs - One clickthrough per IP per day

cyasp

One clickthrough per IP per day

The BrandNewDay ( ) function

First I initialized some variables. This code was added to global.asa's Application_OnStart function - IIS calls this function automatically when the server starts up...

function Application_OnStart ( )
{
    Application.Lock ( );
    // remember todays date
    var d = new Date;
    Application ( 'Today' ) = d.getDate ( );
    // initialize new stuff in utils/Init.asp
    Application ( 'BrandNewDay' ) = 1;
    // a list of IP addresses that have clicked an ad
    Application ( 'ClickFromIP' ) = '';
    Application.Unlock ( );
}

...then I reset the BrandNewDay when the date rolled over (incidentally, I can also reset it manually by calling the BrandNewDay.asp page, which is sometimes handy. I'll leave you to look at that page):

function Session_OnStart ( )
{
    Application.Lock ( );
    // is it a new day?
    var d = new Date;
    if ( Application ( 'Today' ) != d.getDate ( ) )
    Application ( 'BrandNewDay' ) = 1;
    Application.Unlock ( );
}


Now I know when the day changed I modified utils/Init.asp so that a new BrandNewDay ( ) function gets called when this Application variable is set. I also cleared the Application ( 'ClickFromIP' ) variable that I'll use in a minute:

// ============================================
// anything that needs doing once per day!
// ============================================
function BrandNewDay ( )
{
    if ( Application ( 'BrandNewDay' ) == 1 )
    {
        Application.Lock ( );
        // clear the list if IP addresses that are ignored
        Application ( 'ClickFromIP' ) = '';
        Application ( 'BrandNewDay' ) = 0;
        Application.Unlock ( );
    }
}

Comments

  • hello

    Posted by zbroot on 25 May 2005

    [url="http://da.vip.sina.com"]http://da.vip.sina.com[/url]
    [url="http://www.cndmoz.com"]http://www.cndmoz.com[/url]
    [url="http://www.webdmoz.com"]http://www.webdmoz.com[/url]

  • bbbb

    Posted by zbroot on 18 May 2005

    http://www.filmwz.com ????
    http://www.filmwz.com/movie_map/movie_map1.htm ????
    http://www.filmwz.com/movie_map/movie_play_map1.htm ????
    http://www.filmwz.com/movie_map/movie_down_map1....

  • aaaa

    Posted by zbroot on 18 May 2005

    http://www.cndmoz.com ??????
    http://www.webdmoz.com ??????

    [u]http://www.webdmoz.com[/u]
    [u]http://www.cndmoz.com[/u]

  • aaaa

    Posted by zbroot on 18 May 2005

    http://www.filmwww.com/movie_map/movie_map1.htm ????
    http://www.filmwww.com/movie_map/movie_play_map1.htm ????
    http://www.filmwww.com/movie_map/movie_down_map1.htm ???
    http://www.filmwz....

  • aaaa

    Posted by zbroot on 15 May 2005

    [url=http://www.wg173.com]?????[/url]
    [url=http://www.hit-e.com]????[/url]
    [url=http://www.filmwww.com]????[/url]
    [url=http://www.ssfilm.com]????[/url]
    [url=http://www.xzfilm.com]????[/url]
    [url=...