I have been trying to get the ad rotator to work on my site.<BR>Can you tell me if the Const path = needs to be the absolute file location or can it be the URL?If you can I am assuming I will need to change clicks to clicks/<BR>This just will not work for me...the banner just do not show up...Thanks<BR><BR>&#060;%<BR>&#039You will need to include this file, banner.asp, into any files that &#039will be displaying banners. To randomly display a banner, you&#039ll<BR> &#039need only to issue the ASP command:<BR> &#039 ShowBanner<BR> &#039That&#039s it!! :)<BR> sub ShowBanner()<BR> &#039These are constants, don&#039t change the next 7 constants or you&#039ll be in &#039a world of pain!!<BR> Const bannerID = 0<BR> Const bannerCategory = 1<BR> Const bannerWeight = 2<BR> Const advertiserID = 3<BR> Const IMGSRC = 4<BR> Const Description = 5<BR> Const RedirURL = 6<BR> &#039********************************************* *****<BR><BR>&#039OK, you WILL need to change this constant to reflect<BR>&#039the directory where your root directory is housed.<BR>&#039You&#039ll also need to create two subdirectories for<BR>&#039the directory listed below. These two subdirectories will<BR>&#039need to be named "clicks" and "clickthrus"<BR><BR>Const path = "d:INetPubwwwroot
ootcgi-bin\" <BR><BR>&#039We will use the FileSystemObject<BR>Dim fs, banFile<BR>Set fs = Server.CreateObject("Scripting.FileSystemObject")< BR><BR>&#039Open banners.txt for reading<BR> Set banFile = fs.OpenTextFile(path & "Banners.txt",1)<BR><BR><BR>&#039Read the file:<BR> Dim str<BR> str = banFile.ReadAll<BR>&#039 Close file<BR> banFile.Close<BR><BR><BR>&#039Now, split the string into records<BR>Dim records<BR>records = split(str,"*")<BR><BR> intCt = -1<BR> for intX = 0 to ubound(records)-1<BR> if len(trim(replace(records(intX), vbCRLF, " "))) &#062; 0 then<BR> intCt = intCt + 1<BR> else<BR> exit for<BR> end if<BR> next<BR><BR> Dim banInfo(), tempArray<BR> ReDim banInfo(intCt,7)<BR><BR> for i = 0 to intCt<BR> strTemp = records(i)<BR> if left(records(i), 2) = vbCRLF then records(i) = mid(records(i), 3)<BR> tempArray = split(records(i),vbcrlf)<BR> banInfo(i,bannerID) = tempArray(0)<BR> banInfo(i,bannerCategory) = tempArray(1)<BR> banInfo(i,bannerWeight) = tempArray(2)<BR> banInfo(i,advertiserID) = tempArray(3)<BR> banInfo(i,IMGSRC) = tempArray(4)<BR> banInfo(i,Description) = tempArray(5)<BR> banInfo(i,RedirURL) = tempArray(6)<BR> next<BR><BR> &#039Add up all the weights<BR> Dim total<BR> total = 0<BR><BR> for i = 0 to intCt<BR> total = total + CInt(banInfo(i,bannerWeight))<BR> next<BR><BR> &#039Randomly pick a weight<BR> randomize<BR><BR> Dim randNum<BR> randNum = CInt(rnd * total)<BR><BR> Dim count<BR> count = 0<BR> total = 0<BR><BR> for i = 0 to intCt<BR> total = total + banInfo(i,bannerWeight)<BR> if randNum &#060;= total then<BR> i = intCt<BR> else<BR> count = count + 1<BR> end if<BR> next<BR><BR> &#039Print out HREF and IMG<BR> Response.Write("&#060;CENTER&#062;&#060;A<BR> HREF=""http://www.yourserver.com/adredir.asp?" &<BR> banInfo(count,bannerID) & """&#062;")<BR> Response.Write(vbCrLf & "&#060;IMG SRC=""" &<BR> banInfo(count,IMGSRC) & """ BORDER=1 ALT=""Please support<BR> out sponsors!""&#062;")<BR> Response.Write(vbCrLf & "&#060;/A&#062;&#060;/CENTER&#062;" & vbCrLf & vbCrLf)<BR><BR> &#039Update impression stats...<BR> Dim strPath<BR> strPath = path & "clicks\" & banInfo(count,bannerID) & ".txt"<BR><BR> Dim impressions<BR><BR> if fs.FileExists(strPath) then<BR> Set banFile = fs.OpenTextFile(strPath,1)<BR> impressions = CInt(banFile.ReadLine)<BR> else<BR> Set banFile = fs.CreateTextFile(strPath,True)<BR> impressions = 0<BR> end if<BR><BR> impressions = impressions + 1<BR><BR> banFile.close<BR> Set banFile = fs.CreateTextFile(path & "clicks\" &<BR> banInfo(count,bannerID) & ".txt", True)<BR><BR> banFile.WriteLine(impressions)<BR> banFile.close<BR><BR> Set banFile = Nothing<BR> Set fs = Nothing <BR> end sub<BR> %&#062;