<% '*********************************************************************** ' System : ASPBanner Unlimited Version 8.0 ' Author : Christopher Williams of CJWSoft www.CJWSoft.com ' ' COPYRIGHT NOTICE ' ' See attached Software License Agreement ' ' (c) Copyright 2000 - 2005 by CJWSoft. All rights reserved '*********************************************************************** %> <% If BannerZone = "" Then BannerZone = Request("BannerZone") If BannerZone = "" Then BannerZone = Request("BZ") Refresh = Request("Refresh") If Application("BannerRedirectURL") = "" Then Response.Write(vbCrLf & "Banner Redirect URL has not been specified in the ASPBanner settings.
If this is a new installation the settings must be saved at least once because even though they are pre-populated they must be saved.
") Response.End End If If Application("BannerDatabaseType") <> "MSACCESS" or Application("BannerDatabaseType") <> "SQL" or Application("BannerDatabaseType") <> "MYSQL" Then ' Do nothing Else Response.Write(vbCrLf & "BannerDatabaseType variable has not been specified correctly.
It must be set per the instructions.
") Response.End End If ' Checks the time the banner data was last updated and basically updates it if an hour or more has passed If Cint(Application("BannersLastUpdated")) <> Cint(Hour(time)) Then %> <% End If ' Set all variables to empty as this code may be included multiple times in the same page BannerCycleData = "" Banner_Array = "" CurrentBanner = "" CycleBannerTotal = "" NewCycleList = "" NewCycleListArray = "" Banner_Array2 = "" Keep_Processing = "" If Application("BannerZone" & BannerZone & "_Cycle") <> "" Then BannerCycleData = Split(Application("BannerZone" & BannerZone & "_Cycle"),"|") Banner_Array = Split(Application("BannerZone" & BannerZone),"|") Keep_Processing = True Else Keep_Processing = False End If If Keep_Processing = True Then ' This refresh is only initiated when a banner is called with an iframe and a refresh is specified If Refresh <> "" And Refresh <> 0 Then %> <% End If CurrentBanner = BannerCycleData(0) CycleBannerTotal = BannerCycleData(1) NewCycleList = BannerCycleData(2) NewCycleListArray = Split(NewCycleList,",") Banner_Array2 = Split(Banner_Array(NewCycleListArray(CurrentBanner)),vbTab) If Application("DelayedStatsWriting") = "True" Then Set ObjTempBannerStatsFile = Server.CreateObject("Scripting.FileSystemObject") If TempStatsLocation = "" Then BannerStatsFile = Server.MapPath ("/data/tempstats/" & InternationalDate(DATE) & "_" & Trim(Banner_Array2(0)) & "_impressions.tmp") Else BannerStatsFile = (TempStatsLocation & "/" & InternationalDate(DATE) & "_" & Trim(Banner_Array2(0)) & "_impressions.tmp") End If Set ReadBannerStatsFile= ObjTempBannerStatsFile.OpenTextFile (BannerStatsFile, 1, True) If Not ReadBannerStatsFile.AtEndOfStream Then BannerImpressions = Trim(ReadBannerStatsFile.ReadLine) If BannerImpressions = "" Then BannerImpressions = 0 Else BannerImpressions = 0 End If ReadBannerStatsFile.Close Set ReadBannerStatsFile = Nothing BannerImpressions = BannerImpressions + 1 On Error Resume Next Set WriteBannerStatsFile= ObjTempBannerStatsFile.CreateTextFile (BannerStatsFile, True) WriteBannerStatsFile.WriteLine(BannerImpressions) WriteBannerStatsFile.Close Set WriteBannerStatsFile = Nothing Set ObjTempBannerStatsFile = Nothing Else If Application("BannerDatabaseType") = "MYSQL" Then Set ConnBannerSystem = Server.CreateObject("ADODB.Connection") ConnBannerSystem.Open Application("BannerConnectionString") Set cmdTemp = Server.CreateObject("ADODB.Command") Set CmdUpdateStats = Server.CreateObject("ADODB.Recordset") cmdTemp.CommandText = "SELECT * FROM Banner_Stats WHERE (Banner_ID = " & Trim(Banner_Array2(0)) & ") AND Banner_Day = '" & InternationalDate(DATE) & "'" cmdTemp.CommandType = 1 Set cmdTemp.ActiveConnection = ConnBannerSystem CmdUpdateStats.Open cmdTemp, , 2, 2 If Not CmdUpdateStats.EOF Then Banner_ImpressionsNew = CmdUpdateStats("Banner_Impressions") + 1 Set MySQLConn = Server.CreateObject("ADODB.Connection") MySQLConn.Open Application("BannerConnectionString") UpdateStatsSQL = "UPDATE Banner_Stats SET Banner_Impressions = '" & Banner_ImpressionsNew &"' WHERE Banner_ID = '" & Trim(Banner_Array2(0)) & "' AND Banner_Day = '" & InternationalDate(DATE) & "';" MySQLConn.Execute UpdateStatsSQL MySQLConn.Close Set MySQLConn = Nothing Else Set MySQLConn = Server.CreateObject("ADODB.Connection") MySQLConn.Open Application("BannerConnectionString") UpdateStatsSQL = "INSERT INTO Banner_Stats (Stat_ID,Banner_ID,Banner_Day,Banner_Impressions,Banner_Clicks) VALUES ('','" & Trim(Banner_Array2(0)) & "','" & InternationalDate(DATE) & "','1','0');" MySQLConn.Execute UpdateStatsSQL MySQLConn.Close Set MySQLConn = Nothing End If ConnBannerSystem.Close Set ConnBannerSystem = Nothing Else Set ConnBannerSystem = Server.CreateObject("ADODB.Connection") ConnBannerSystem.Open Application("BannerConnectionString") Set CmdBannerTemp = Server.CreateObject("ADODB.Command") Set CmdUpdateStats = Server.CreateObject("ADODB.Recordset") If Application("BannerDatabaseType") = "SQL" or Application("BannerDatabaseType") = "MYSQL" Then CmdBannerTemp.CommandText = "SELECT Banner_Stats.* FROM Banner_Stats WHERE (Banner_ID = " & Trim(Banner_Array2(0)) & ") AND Banner_Day = '" & InternationalDate(DATE) & "'" ElseIf Application("BannerDatabaseType") = "MSACCESS" Then CmdBannerTemp.CommandText = "SELECT Banner_Stats.* FROM Banner_Stats WHERE (Banner_ID = " & Trim(Banner_Array2(0)) & ") AND Banner_Day = #" & InternationalDate(DATE) & "#" End If CmdBannerTemp.CommandType = 1 Set CmdBannerTemp.ActiveConnection = ConnBannerSystem CmdUpdateStats.Open CmdBannerTemp, , 2, 2 If Not CmdUpdateStats.EOF Then CmdUpdateStats.Fields("Banner_Impressions") = (CmdUpdateStats("Banner_Impressions") + 1) CmdUpdateStats.Update CmdUpdateStats.Close Set CmdUpdateStats = Nothing Else Set CmdBannerTemp = Server.CreateObject("ADODB.Command") Set CmdUpdateStats = Server.CreateObject("ADODB.Recordset") CmdBannerTemp.CommandText = "SELECT Banner_Stats.* FROM Banner_Stats" Set CmdBannerTemp.ActiveConnection = ConnBannerSystem CmdUpdateStats.Open CmdBannerTemp, , 2, 2 CmdUpdateStats.AddNew CmdUpdateStats.Fields("Banner_ID") = Trim(Banner_Array2(0)) CmdUpdateStats.Fields("Banner_Day") = InternationalDate(DATE) CmdUpdateStats.Fields("Banner_Impressions") = 1 CmdUpdateStats.Fields("Banner_Clicks") = 0 CmdUpdateStats.Update CmdUpdateStats.Close Set CmdUpdateStats = Nothing End If ConnBannerSystem.Close Set ConnBannerSystem = Nothing End If End If ' Banner Type Image Process Like So If (Banner_Array2(9)) = "Image" Then If ISNumeric(Banner_Array2(0)) = True Then %> SpongeIDF 8 <% End If End If ' Banner Type Code Process Like So If (Banner_Array2(9)) = "Code" Then Response.Write (Replace(base64_decode(Banner_Array2(8)),"<-random->",RndStr(8,"123456789abcdefghijkmnpqrstuvwxyz"))) 'Response.Write (base64_decode(Banner_Array2(8))) End If If Cint(CurrentBanner) = Cint(CycleBannerTotal - 1) Then CurrentBanner = 0 Else CurrentBanner = CurrentBanner + 1 End If Application.Lock Application("BannerZone" & BannerZone & "_Cycle") = CurrentBanner & "|" & CycleBannerTotal & "|" & NewCycleList Application.Unlock ' This is the End If for the (Keep_Processing = True) line End If %>