<%@ Language=VBScript %> <% CheckValueQueryString %> <% Response.Expires = 0 Response.Expiresabsolute = Now() - 1 Response.AddHeader "Pragma","no-cache" Response.AddHeader "Cache-Control","no-cache, must-revalidate" set DBCon = server.CreateObject("ADODB.Connection") DBCon.Open Application("DB_ConnectionString"), "","" id = Request.QueryString ("id") if id="" then dbcon.Close set dbcon=nothing Response.Redirect "/" end if set rs=dbcon.Execute ("SELECT * FROM banners WHERE banner_ID="+Cstr(id)+";") if rs.eof = true then rs.close set rs=nothing dbcon.Close set dbcon=nothing Response.Redirect "/" end if redir=rs.fields("banner_Company") rs.close set rs=nothing set ri=dbcon.Execute ("SELECT * FROM banner_stats WHERE bh_BannerID="+Cstr(id)+" AND bh_Date=dbo.GetDateEx(GetDate());") if ri.eof = true then dbcon.execute("INSERT INTO banner_Stats (bh_BannerID,bh_Date,bh_Impressions,bh_Clicks) VALUES("+cstr(id)+",dbo.GetDateEx(getdate()),0,0);") end if ri.close set ri=nothing dbcon.Execute ("UPDATE banner_stats SET bh_Clicks=bh_Clicks+1 WHERE bh_BannerID="+Cstr(id)+" AND bh_Date=dbo.GetDateEx(GetDate());") dbcon.Close set dbcon=nothing Response.Redirect redir %>