"" then
okrug_str="district = 0"
if instr(okrug_banner,"Северный")>0 then okrug_str = okrug_str & " or district = 2"
if instr(okrug_banner,"Северо-Западный")>0 then okrug_str = okrug_str & " or district = 3"
if instr(okrug_banner,"West")>0 then okrug_str = okrug_str & " or district = 4"
if instr(okrug_banner,"Юго-Западный")>0 then okrug_str = okrug_str & " or district = 5"
if instr(okrug_banner,"Южный")>0 then okrug_str = okrug_str & " or district = 6"
if instr(okrug_banner,"Юго-Восточный")>0 then okrug_str = okrug_str & " or district = 7"
if instr(okrug_banner,"East")>0 then okrug_str = okrug_str & " or district = 8"
if instr(okrug_banner,"Северо-Восточный")>0 then okrug_str = okrug_str & " or district = 9"
if instr(okrug_banner,"Центральный")>0 then okrug_str = okrug_str & " or district = 10"
if instr(okrug_banner,"Московская область")>0 then okrug_str = okrug_str & " or district = 12"
if instr(okrug_banner,"Зеленоград")>0 then okrug_str = okrug_str & " or district = 11"
end if
if int(place_id)=0 then
'Это для совместимости с ASP
place_id = int( Request("place_id"))
end if
if int(ban_id)=0 then
'Это для совместимости с ASP
ban_id = int( Request("ban_id"))
end if
if place_id=0 then
query = "select * from banners where activ=1 and ban_id = " & ban_id
else
query = "select * from banners where activ=1 and place = " & place_id
end if
if int(okrug_only)=0 then
'Это для совместимости с ASP
ban_id = int( Request("okrug_only"))
end if
if okrug_only=1 then
query = query & " and (" & okrug_str & ")"
else
query = query & " and district = 1"
end if
Set objRS = objConn.Execute(query)
number = objRS.RecordCount
if number>0 then
''если нашли
''сначала выводим
ban_html = objRS.Fields("ban_html") & ""
''ban_html = "" ''' это на будущее для flash баннеров, если появятся - убрать строку
ban_id = objRS.Fields("ban_id")
if ban_html = "" then
ban_html = "
"
ban_html = ban_html & ""
end if 'if ban_html = ""
'теперь счетчики
Function mmonth(d)
m = month(d)
If Not(m=12 Or m=11 or m=10) Then m="0"&m
mmonth = m
End Function
cmonth = mmonth(date())
cyear = year(date())
query2 = "update banners SET ban_show = ban_show+1 where ban_id = " & ban_id
Set res2 = objConn.Execute(query2)
'Response.Write "
query1 - " & query2 & "
"
'детальная статистика
query2 = "select * from ban_stat where s_year=" & cyear & " and s_month = " & month(date()) & " and id_ban=" & ban_id
Set res2 = objConn.Execute(query2)
num_st = res2.RecordCount
if num_st>0 then
query2 = "update ban_stat set banner=banner+1 where s_year=" & cyear & " and s_month = " & month(date()) & " and id_ban=" & ban_id & " limit 1"
else
query2 = "INSERT into ban_stat (id_ban, s_year, s_month, count, ref_count,banner, ref2_count) VALUES (" & ban_id & "," & cyear & "," & month(date()) & ",0,0,1,0)"
end if
'Response.Write "
query2 - " & query2 & "
"
Set res2 = objConn.Execute(query2)
'''Пока есть Access - дублируем туда
Set DB_showban = Server.CreateObject("ADODB.Connection")
DB_showban.CursorLocation=3
DB_showban.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=D:\vhosts\znania.ru\httpdocs\db\banners.mdb;"
strSQL = "SELECT *FROM primary where id = " & ban_id
Set RS_showban = DB_showban.Execute(strSQL)
item_val = RS_showban.RecordCount
IF item_val>0 then
strSQL = "update primary SET ban_show = ban_show +1 where id = " & ban_id
else
strSQL = "insert into primary (id, name, ban_show) values (" & ban_id & ", '" & objRS.Fields("uz_name") & "',1)"
end if
Set RS_showban = DB_showban.Execute(strSQL)
strSQL = "select id from stats where s_year='" & cyear & "' and s_month='" & cmonth & "' and inst=" & ban_id
set RS_showban = DB_showban.Execute(strSQL)
item_val = RS_showban.RecordCount
if item_val>0 then
strSQL = "update stats set banner=banner+1 where s_year='" & cyear & "' and s_month = '" & cmonth & "' and inst=" & ban_id
else
strSQL = "INSERT into stats (inst, s_year, s_month, count, ref_count,banner, ref2_count) VALUES (" & ban_id & ",'" & cyear & "','" & cmonth & "',0,0,1,0)"
end if
'Response.Write strSQL
RS_showban = DB_showban.Execute(strSQL)
Set RS_showban = Nothing
DB_showban.Close
Set DB_showban = Nothing
Response.Write ban_html
else
''если нет таких
Response.Write ""
end if ' if number>0 then
%>
"" then
okrug_str="district = 0"
if instr(okrug_banner,"Северный")>0 then okrug_str = okrug_str & " or district = 2"
if instr(okrug_banner,"Северо-Западный")>0 then okrug_str = okrug_str & " or district = 3"
if instr(okrug_banner,"West")>0 then okrug_str = okrug_str & " or district = 4"
if instr(okrug_banner,"Юго-Западный")>0 then okrug_str = okrug_str & " or district = 5"
if instr(okrug_banner,"Южный")>0 then okrug_str = okrug_str & " or district = 6"
if instr(okrug_banner,"Юго-Восточный")>0 then okrug_str = okrug_str & " or district = 7"
if instr(okrug_banner,"East")>0 then okrug_str = okrug_str & " or district = 8"
if instr(okrug_banner,"Северо-Восточный")>0 then okrug_str = okrug_str & " or district = 9"
if instr(okrug_banner,"Центральный")>0 then okrug_str = okrug_str & " or district = 10"
if instr(okrug_banner,"Московская область")>0 then okrug_str = okrug_str & " or district = 12"
if instr(okrug_banner,"Зеленоград")>0 then okrug_str = okrug_str & " or district = 11"
end if
if int(place_id)=0 then
'Это для совместимости с ASP
place_id = int( Request("place_id"))
end if
if int(ban_id)=0 then
'Это для совместимости с ASP
ban_id = int( Request("ban_id"))
end if
if place_id=0 then
query = "select * from banners where activ=1 and ban_id = " & ban_id
else
query = "select * from banners where activ=1 and place = " & place_id
end if
if int(okrug_only)=0 then
'Это для совместимости с ASP
ban_id = int( Request("okrug_only"))
end if
if okrug_only=1 then
query = query & " and (" & okrug_str & ")"
else
query = query & " and district = 1"
end if
Set objRS = objConn.Execute(query)
number = objRS.RecordCount
if number>0 then
''если нашли
''сначала выводим
ban_html = objRS.Fields("ban_html") & ""
''ban_html = "" ''' это на будущее для flash баннеров, если появятся - убрать строку
ban_id = objRS.Fields("ban_id")
if ban_html = "" then
ban_html = "
"
ban_html = ban_html & ""
end if 'if ban_html = ""
'теперь счетчики
Function mmonth(d)
m = month(d)
If Not(m=12 Or m=11 or m=10) Then m="0"&m
mmonth = m
End Function
cmonth = mmonth(date())
cyear = year(date())
query2 = "update banners SET ban_show = ban_show+1 where ban_id = " & ban_id
Set res2 = objConn.Execute(query2)
'Response.Write "
query1 - " & query2 & "
"
'детальная статистика
query2 = "select * from ban_stat where s_year=" & cyear & " and s_month = " & month(date()) & " and id_ban=" & ban_id
Set res2 = objConn.Execute(query2)
num_st = res2.RecordCount
if num_st>0 then
query2 = "update ban_stat set banner=banner+1 where s_year=" & cyear & " and s_month = " & month(date()) & " and id_ban=" & ban_id & " limit 1"
else
query2 = "INSERT into ban_stat (id_ban, s_year, s_month, count, ref_count,banner, ref2_count) VALUES (" & ban_id & "," & cyear & "," & month(date()) & ",0,0,1,0)"
end if
'Response.Write "
query2 - " & query2 & "
"
Set res2 = objConn.Execute(query2)
'''Пока есть Access - дублируем туда
Set DB_showban = Server.CreateObject("ADODB.Connection")
DB_showban.CursorLocation=3
DB_showban.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=D:\vhosts\znania.ru\httpdocs\db\banners.mdb;"
strSQL = "SELECT *FROM primary where id = " & ban_id
Set RS_showban = DB_showban.Execute(strSQL)
item_val = RS_showban.RecordCount
IF item_val>0 then
strSQL = "update primary SET ban_show = ban_show +1 where id = " & ban_id
else
strSQL = "insert into primary (id, name, ban_show) values (" & ban_id & ", '" & objRS.Fields("uz_name") & "',1)"
end if
Set RS_showban = DB_showban.Execute(strSQL)
strSQL = "select id from stats where s_year='" & cyear & "' and s_month='" & cmonth & "' and inst=" & ban_id
set RS_showban = DB_showban.Execute(strSQL)
item_val = RS_showban.RecordCount
if item_val>0 then
strSQL = "update stats set banner=banner+1 where s_year='" & cyear & "' and s_month = '" & cmonth & "' and inst=" & ban_id
else
strSQL = "INSERT into stats (inst, s_year, s_month, count, ref_count,banner, ref2_count) VALUES (" & ban_id & ",'" & cyear & "','" & cmonth & "',0,0,1,0)"
end if
'Response.Write strSQL
RS_showban = DB_showban.Execute(strSQL)
Set RS_showban = Nothing
DB_showban.Close
Set DB_showban = Nothing
Response.Write ban_html
else
''если нет таких
Response.Write ""
end if ' if number>0 then
%>
"" then
okrug_str="district = 0"
if instr(okrug_banner,"Северный")>0 then okrug_str = okrug_str & " or district = 2"
if instr(okrug_banner,"Северо-Западный")>0 then okrug_str = okrug_str & " or district = 3"
if instr(okrug_banner,"West")>0 then okrug_str = okrug_str & " or district = 4"
if instr(okrug_banner,"Юго-Западный")>0 then okrug_str = okrug_str & " or district = 5"
if instr(okrug_banner,"Южный")>0 then okrug_str = okrug_str & " or district = 6"
if instr(okrug_banner,"Юго-Восточный")>0 then okrug_str = okrug_str & " or district = 7"
if instr(okrug_banner,"East")>0 then okrug_str = okrug_str & " or district = 8"
if instr(okrug_banner,"Северо-Восточный")>0 then okrug_str = okrug_str & " or district = 9"
if instr(okrug_banner,"Центральный")>0 then okrug_str = okrug_str & " or district = 10"
if instr(okrug_banner,"Московская область")>0 then okrug_str = okrug_str & " or district = 12"
if instr(okrug_banner,"Зеленоград")>0 then okrug_str = okrug_str & " or district = 11"
end if
if int(place_id)=0 then
'Это для совместимости с ASP
place_id = int( Request("place_id"))
end if
if int(ban_id)=0 then
'Это для совместимости с ASP
ban_id = int( Request("ban_id"))
end if
if place_id=0 then
query = "select * from banners where activ=1 and ban_id = " & ban_id
else
query = "select * from banners where activ=1 and place = " & place_id
end if
if int(okrug_only)=0 then
'Это для совместимости с ASP
ban_id = int( Request("okrug_only"))
end if
if okrug_only=1 then
query = query & " and (" & okrug_str & ")"
else
query = query & " and district = 1"
end if
Set objRS = objConn.Execute(query)
number = objRS.RecordCount
if number>0 then
''если нашли
''сначала выводим
ban_html = objRS.Fields("ban_html") & ""
''ban_html = "" ''' это на будущее для flash баннеров, если появятся - убрать строку
ban_id = objRS.Fields("ban_id")
if ban_html = "" then
ban_html = "
"
ban_html = ban_html & ""
end if 'if ban_html = ""
'теперь счетчики
Function mmonth(d)
m = month(d)
If Not(m=12 Or m=11 or m=10) Then m="0"&m
mmonth = m
End Function
cmonth = mmonth(date())
cyear = year(date())
query2 = "update banners SET ban_show = ban_show+1 where ban_id = " & ban_id
Set res2 = objConn.Execute(query2)
'Response.Write "
query1 - " & query2 & "
"
'детальная статистика
query2 = "select * from ban_stat where s_year=" & cyear & " and s_month = " & month(date()) & " and id_ban=" & ban_id
Set res2 = objConn.Execute(query2)
num_st = res2.RecordCount
if num_st>0 then
query2 = "update ban_stat set banner=banner+1 where s_year=" & cyear & " and s_month = " & month(date()) & " and id_ban=" & ban_id & " limit 1"
else
query2 = "INSERT into ban_stat (id_ban, s_year, s_month, count, ref_count,banner, ref2_count) VALUES (" & ban_id & "," & cyear & "," & month(date()) & ",0,0,1,0)"
end if
'Response.Write "
query2 - " & query2 & "
"
Set res2 = objConn.Execute(query2)
'''Пока есть Access - дублируем туда
Set DB_showban = Server.CreateObject("ADODB.Connection")
DB_showban.CursorLocation=3
DB_showban.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=D:\vhosts\znania.ru\httpdocs\db\banners.mdb;"
strSQL = "SELECT *FROM primary where id = " & ban_id
Set RS_showban = DB_showban.Execute(strSQL)
item_val = RS_showban.RecordCount
IF item_val>0 then
strSQL = "update primary SET ban_show = ban_show +1 where id = " & ban_id
else
strSQL = "insert into primary (id, name, ban_show) values (" & ban_id & ", '" & objRS.Fields("uz_name") & "',1)"
end if
Set RS_showban = DB_showban.Execute(strSQL)
strSQL = "select id from stats where s_year='" & cyear & "' and s_month='" & cmonth & "' and inst=" & ban_id
set RS_showban = DB_showban.Execute(strSQL)
item_val = RS_showban.RecordCount
if item_val>0 then
strSQL = "update stats set banner=banner+1 where s_year='" & cyear & "' and s_month = '" & cmonth & "' and inst=" & ban_id
else
strSQL = "INSERT into stats (inst, s_year, s_month, count, ref_count,banner, ref2_count) VALUES (" & ban_id & ",'" & cyear & "','" & cmonth & "',0,0,1,0)"
end if
'Response.Write strSQL
RS_showban = DB_showban.Execute(strSQL)
Set RS_showban = Nothing
DB_showban.Close
Set DB_showban = Nothing
Response.Write ban_html
else
''если нет таких
Response.Write ""
end if ' if number>0 then
%>