<% '*********************************************************************** ' System : ASPBanner ' Author : Christopher Williams of CJWSoft www.CJWSoft.com ' ' COPYRIGHT NOTICE ' ' See attached Software License Agreement ' ' (c) Copyright 2000 - 2001 by CJWSoft. All rights reserved '*********************************************************************** %> <% Session.LCID = 1033 %> <% ' 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("BannerLocation" & BannerZone & "_Cycle") <> "" Then BannerCycleData = Split(Application("BannerLocation" & BannerZone & "_Cycle"),"|") Banner_Array = Split(Application("BannerLocation" & BannerZone),"|") Keep_Processing = True Else Keep_Processing = False End If %> <% If Keep_Processing = True Then CurrentBanner = BannerCycleData(0) CycleBannerTotal = BannerCycleData(1) NewCycleList = BannerCycleData(2) NewCycleListArray = Split(NewCycleList,",") Banner_Array2 = Split(Banner_Array(NewCycleListArray(CurrentBanner)),vbTab) Set ConnPasswords = Server.CreateObject("ADODB.Connection") ConnPasswords.Open BannerConnectionString Set cmdTemp = Server.CreateObject("ADODB.Command") Set CmdUpdateStats = Server.CreateObject("ADODB.Recordset") If BannerDatabaseType = "SQL" Then cmdTemp.CommandText = "SELECT Banner_Stats.* FROM Banner_Stats WHERE (Banner_ID = " & Trim(Banner_Array2(0)) & ") AND Banner_Day = '" & DATE & "'" ElseIf BannerDatabaseType = "MSACCESS" Then cmdTemp.CommandText = "SELECT Banner_Stats.* FROM Banner_Stats WHERE (Banner_ID = " & Trim(Banner_Array2(0)) & ") AND Banner_Day = #" & DATE & "#" End If cmdTemp.CommandType = 1 Set cmdTemp.ActiveConnection = ConnPasswords CmdUpdateStats.Open cmdTemp, , 1, 3 If Not CmdUpdateStats.EOF Then CmdUpdateStats.Fields("Banner_Impressions") = (CmdUpdateStats("Banner_Impressions") + 1) CmdUpdateStats.Update CmdUpdateStats.Close Set CmdUpdateStats = Nothing Else Set cmdTemp = Server.CreateObject("ADODB.Command") Set CmdUpdateStats = Server.CreateObject("ADODB.Recordset") cmdTemp.CommandText = "SELECT Banner_Stats.* FROM Banner_Stats" Set cmdTemp.ActiveConnection = ConnPasswords CmdUpdateStats.Open cmdTemp, , 1, 3 CmdUpdateStats.AddNew CmdUpdateStats.Fields("Banner_ID") = Trim(Banner_Array2(0)) CmdUpdateStats.Fields("Banner_Day") = DATE CmdUpdateStats.Fields("Banner_Impressions") = 1 CmdUpdateStats.Fields("Banner_Clicks") = 0 CmdUpdateStats.Update CmdUpdateStats.Close Set CmdUpdateStats = Nothing End If ConnPasswords.Close Set ConnPasswords = Nothing %> <% ' Banner Type Image Process Like So If (Banner_Array2(9)) = "Image" Then If ISNumeric(Banner_Array2(0)) = True Then %> <% =Trim(Banner_Array2(6)) %> "" Then %>width="<% =Trim(Banner_Array2(2)) %>" <% End If %> <% If Trim(Banner_Array2(3)) <> "" Then %>height="<% =Trim(Banner_Array2(3)) %>"<% End If %>> <% End If If Trim(Banner_Array2(5)) <> "" Then %>
<% =Trim(Banner_Array2(5)) %> <% End If End If ' Banner Type Code Process Like So If (Banner_Array2(9)) = "Code" Then Response.Write (Banner_Array2(8)) End If %> <% If Cint(CurrentBanner) = Cint(CycleBannerTotal - 1) Then CurrentBanner = 0 Else CurrentBanner = CurrentBanner + 1 End If Application.Lock Application("BannerLocation" & BannerZone & "_Cycle") = CurrentBanner & "|" & CycleBannerTotal & "|" & NewCycleList Application.Unlock ' This is the End If for the (Keep_Processing = True) line End If %>