<% if page = "demo" then if Request("gatewayID") = "" then gatewayID = 54 else gatewayID = Request("gatewayID") end if else radioSQL = "select format, call1, af1, city, state, gateway from radio where id = " & id & " and active = 1" set radioRS = dbConn.Execute(radioSQL) if not radioRS.EOF then rdoFormat = radioRS("format") callLetters = radioRS("call1") & "-" & radioRS("af1") city = radioRS("city") state = radioRS("state") gateway = radioRS("gateway") else Response.write "No station found" end if if inStr(gateway, "N") then 'do nothing else chkStationsSQL = "select gpd.gatewayID, gs.id as 'sgsID', gpd.impCount from ((gateway_stations gss " _ & "inner join gateway_schedule gs " _ & "on gs.id = gss.schedule_id) " _ & "inner join gateway_location gl " _ & "on gl.schedule_id = gss.schedule_id) " _ & "inner join gatewayperDayperStation gpd " _ & "on gpd.gatewayID = gl.schedule_id " _ & "where gss.radioID = '" & id & "' and gpd.radioID = '" & id & "' " _ & "and gpd.date_entered = '" & today & "' and active = 1 and live = 'live' and geo = 0 " _ & "and '" & today & "' between gs.flightStart and gs.flightEnd " _ & "and [default] = 0 and gpd.impCount < gs.dailyImps order by gpd.impCount asc" set chkStationsRS = dbConn.Execute(chkStationsSQL) if not chkStationsRS.EOF then Randomize stations1=Int(chkStationsRS.RecordCount*Rnd+1) i=1 do while not chkStationsRS.EOF if i=stations1 then stations_schedule_id = chkStationsRS("gatewayID") stationsTest = "true" sgsID = chkStationsRS("sgsID") sgsImpCount = chkStationsRS("impCount") end if i=i+1 chkStationsRS.MoveNext Loop else stationsTest = "false" end if gatewayID = stations_schedule_id gsID = sgsID end if end if gatewayID = 96 if gatewayID <> "" then tSQL = "select adType from gateway_location where schedule_id = " & gatewayID set tRS = dbConn.Execute(tSQL) if not tRS.EOF then adType = tRS("adType") end if end if 'insert tracking trackgatewaySQL = "insert into [trackgateway_" & today & "] " _ & "(radioID, " _ & "gatewayID, " _ & "listenerIP, " _ & "date_entered, " _ & "time_entered, " _ & "streamPage, " _ & "city, " _ & "region, " _ & "country, " _ & "metroCode, " _ & "OS, " _ & "ua, " _ & "wmpVer, " _ & "streamType," _ & "FlashVer, " _ & "Broadband, " _ & "heightAvail, " _ & "height, " _ & "widthAvail, " _ & "width, " _ & "br, " _ & "brVer)" _ & "values " _ & "(" & id & ", " _ & "'" & gatewayID & "', " _ & "'" & listenerIP & "', " _ & "'" & date_entered & "', " _ & "'" & whattimeisit & "', " _ & "'" & page & "'," _ & "'" & city & "', " _ & "'" & region & "', " _ & "'" & country & "', " _ & "'" & metroCode & "', " _ & "'" & os & "', " _ & "'" & strUA & "', " _ & "'" & wmpVer & "', " _ & "'wmp', " _ & "'" & FlashVer & "', " _ & "'" & Broadband & "', " _ & "'" & heightAvail & "', " _ & "'" & height & "', " _ & "'" & widthAvail & "', " _ & "'" & width & "', " _ & "'" & br & "', " _ & "'" & brVer & "')" dbConn.Execute(trackgatewaySQL) %>