<% Option Explicit 'For the love of God, please don't change these constants. Const bannerID = 0 Const bannerCategory = 1 Const bannerWeight = 2 Const advertiserID = 3 Const IMGSRC = 4 Const Description = 5 Const RedirURL = 6 'First, we need to get the information from the calling URL Dim banID, i banID = Request.QueryString 'Open the banner list file 'Again, you'll need to set this constant here to your 'directory Const path = "c:\INetPub\wwwroot\" Dim fs, banFile Set fs = Server.CreateObject("Scripting.FileSystemObject") Set banFile = fs.OpenTextFile(path & "Banners.txt",1) 'Read the file: Dim str str = banFile.ReadAll ' Close file banFile.Close 'Now, split the string into records Dim records records = split(str,"*") Dim banInfo(), tempArray ReDim banInfo(UBound(records),7) for i = LBound(records) to UBound(records) if right(records(i),1) = chr(10) then records(i) = left(records(i), len(records(i)) - 1) end if if left(records(i),1) = chr(10) then records(i) = right(records(i), len(records(i)) - 1) end if tempArray = split(records(i),chr(10)) banInfo(i,bannerID) = tempArray(0) banInfo(i,bannerCategory) = tempArray(1) banInfo(i,bannerWeight) = tempArray(2) banInfo(i,advertiserID) = tempArray(3) banInfo(i,IMGSRC) = tempArray(4) banInfo(i,Description) = tempArray(5) banInfo(i,RedirURL) = tempArray(6) next 'Find the appropriate banner Dim banPos banPos = LBound(records) for i = LBound(records) to UBound(records) if CInt(banInfo(i,bannerID)) = CInt(banID) then banPos = i i = UBound(records) end if next 'Now, we have all our information crammed into banInfo 'We are just interested, though, in banInfo(banPos,0..5) 'Update clickthrough stats... Dim strPath strPath = path & "clickthrus\" & banInfo(banPos,bannerID) & ".txt" Dim clicks if fs.FileExists(strPath) then Set banFile = fs.OpenTextFile(strPath,1) clicks = CInt(banFile.ReadLine) else Set banFile = fs.CreateTextFile(strPath,True) clicks = 0 end if clicks = clicks + 1 banFile.close Set banFile = fs.CreateTextFile(path & "clickthrus\" & banInfo(banPos,bannerID) & ".txt", True) banFile.WriteLine(clicks) banFile.close 'Send the user off to the appropriate site Response.Redirect banInfo(banPos,RedirURL) Set banFile = Nothing Set fs = Nothing %>