%
allowbanners = True
'allowbanners = False
If allowbanners Then
'***********************************************************************
' System : ASPBanner Unlimited
' Author : Christopher Williams of CJWSoft www.CJWSoft.com
'
' COPYRIGHT NOTICE
'
' See attached Software License Agreement
'
' (c) Copyright 2000 - 2003 by CJWSoft. All rights reserved
'***********************************************************************
%>
<%
If BannerZone = "" Then BannerZone = Request("BannerZone")
If IsNull(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
' 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
CurrentBanner = BannerCycleData(0)
CycleBannerTotal = BannerCycleData(1)
NewCycleList = BannerCycleData(2)
NewCycleListArray = Split(NewCycleList,",")
Banner_Array2 = Split(Banner_Array(NewCycleListArray(CurrentBanner)),vbTab)
Set ConnBannerSystem = Server.CreateObject("ADODB.Connection")
ConnBannerSystem.Open BannerConnectionString
Set CmdBannerTemp = Server.CreateObject("ADODB.Command")
Set CmdUpdateStats = Server.CreateObject("ADODB.Recordset")
If BannerDatabaseType = "SQL" Then
CmdBannerTemp.CommandText = "SELECT Banner_Stats.* FROM Banner_Stats WHERE (Banner_ID = " & Trim(Banner_Array2(0)) & ") AND Banner_Day = '" & InternationalDate(DATE) & "'"
ElseIf 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, , 1, 3
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, , 1, 3
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
' Banner Type Image Process Like So
If (Banner_Array2(9)) = "Image" Then
If ISNumeric(Banner_Array2(0)) = True Then
%>
?Banner_ID=<% =Trim(Banner_Array2(0)) %>" target="<% =Trim(Banner_Array2(7)) %>">
"" 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
%>
?Banner_ID=<% =Trim(Banner_Array2(0)) %>" target="<% =Trim(Banner_Array2(7)) %>"><% =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("BannerZone" & BannerZone & "_Cycle") = CurrentBanner & "|" & CycleBannerTotal & "|" & NewCycleList
Application.Unlock
' This is the End If for the (Keep_Processing = True) line
End If
End if
%>