You are viewing a plain-jane printable version of http://CoverYourASP.com/LimitIP2.asp.See how this was done
| ||||
One clickthrough per IP per dayThe first idea I implemented was to only count one clickthough per IP address per day. I didn't want to use a database or file to store the IP addresses, and then search for them - that's a little over the top. So I had the idea that I'd use an Application variable - which would get emptied each day. The BrandNewDay ( ) functionFirst 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...
...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):
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:
|