%
Response.Buffer = True
Response.ContentType = "application/x-javascript"
BannerZone = Request("BannerZone")
'***********************************************************************
' 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 IsNull(Application("BannerRedirectURL")) Then
Response.Write(vbCrLf & "jscode='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 = ""
Stop_Processing = ""
BR = ""
BN = ""
IIS = ""
IW = ""
IH = ""
IB = ""
IAT = ""
IA = ""
BT = ""
JSCRIPT_Code = ""
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 = '" & DATE & "'"
ElseIf BannerDatabaseType = "MSACCESS" Then
CmdBannerTemp.CommandText = "SELECT Banner_Stats.* FROM Banner_Stats WHERE (Banner_ID = " & Trim(Banner_Array2(0)) & ") AND Banner_Day = #" & 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") = 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
JSCRIPT_Code = vbCrLf
' Banner Type Image Process Like So
If (Banner_Array2(9)) = "Image" Then
If ISNumeric(Banner_Array2(0)) = True Then
BR = Application("BannerRedirectURL")
BN = Trim(Banner_Array2(0))
IIS = Trim(Banner_Array2(1))
IW = Trim(Banner_Array2(2))
IH = Trim(Banner_Array2(3))
IB = Trim(Banner_Array2(4))
IAT = Trim(Banner_Array2(5))
IA = Trim(Banner_Array2(6))
BT = Trim(Banner_Array2(7))
JSCRIPT_Code = JSCRIPT_Code & ""
JSCRIPT_Code = JSCRIPT_Code & "
" & " "
End If
If Trim(Banner_Array2(5)) <> "" Then
JSCRIPT_Code = JSCRIPT_Code & "
"
JSCRIPT_Code = JSCRIPT_Code & ""
JSCRIPT_Code = JSCRIPT_Code & " " & IAT & ""
End If
End If
' Banner Type Code Process Like So
If (Banner_Array2(9)) = "Code" Then
JSCRIPT_Code = (Banner_Array2(8))
End If
JSCRIPT_Code = Replace( JSCRIPT_Code, "'", "\'" )
JSCRIPT_Code = "jscode='" & JSCRIPT_Code & "'"
Response.Write Replace(JSCRIPT_Code, vbCrLf, " ")
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
%>