%
dim getplace,getshow,adsrs,adssql,adsrsp,adssqlp,adsrss,adssqls,getip
adsconn.open adsdata
set adsrsp=server.createobject("adodb.recordset")
adssqlp="Select * from [ads] where act=1 and class <> 0 order by gtime"
adsrsp.open adssqlp,adsconn,1,3
while not adsrsp.eof
advertvirtualvalue=0
if adsrsp("class")=1 then
if adsrsp("click")>=adsrsp("clicks") then
advertvirtualvalue=1
end if
elseif adsrsp("class")=2 then
if adsrsp("show")>=adsrsp("shows") then
advertvirtualvalue=1
end if
elseif adsrsp("class")=3 then
if now()>=adsrsp("lasttime") then
advertvirtualvalue=1
end if
elseif adsrsp("class")=4 then
if adsrsp("click")>=adsrsp("clicks") then
advertvirtualvalue=1
end if
if adsrsp("show")>=adsrsp("shows") then
advertvirtualvalue=1
end if
elseif adsrsp("class")=5 then
if adsrsp("click")>=adsrsp("clicks") then
advertvirtualvalue=1
end if
if now()>=adsrsp("lasttime") then
advertvirtualvalue=1
end if
elseif adsrsp("class")=6 then
if adsrsp("show")>=adsrsp("shows") then
advertvirtualvalue=1
end if
if now()>=adsrsp("lasttime") then
advertvirtualvalue=1
end if
elseif adsrsp("class")=7 then
if adsrsp("click")>=adsrsp("clicks") then
advertvirtualvalue=1
end if
if adsrsp("show")>=adsrsp("shows") then
advertvirtualvalue=1
end if
if now()>=adsrsp("lasttime") then
advertvirtualvalue=1
end if
end if
if advertvirtualvalue>=1 then
adsrsp("act")=2
adsrsp.update
end if
adsrsp.movenext
wend
adsrsp.close
set adsrsp=nothing
adsconn.close
adsconn.open adsdata
if request.querystring("place")>5 then
getplace=0
else
getplace=cint(request.querystring("place"))
end if
set adsrs=server.createobject("adodb.recordset")
adssql="Select top 1 id,gif_url,window,show,place,gtime from [ads] where act=1 and place="&getplace&" order by gtime"
'response.Write(adssql)
'response.End()
adsrs.open adssql,adsconn,1,3
getshow=adsrs("show")+1
adsrs("show")=getshow
adsrs("gtime")=now()
adsrs.Update
swf=right(adsrs("gif_url"),3)
if adsrs("window")=0 then
ttarg = "_blank"
else
ttarg="_top"
end if
%>
<% if swf="gif" or swf="jpg" then %>
document.write('" target="<%=ttarg%>">">');
<% else %>
document.write('')
<% end if %>
<%
'getip=request.ServerVariables("REMOTE_ADDR")
'set adsrss=server.createobject("adodb.recordset")
'adssqls="select * from iplist"
'adsrss.open adssqls,adsconn,1,3
'adsrss.AddNew
'adsrss("adid") =adsrs("id")
'adsrss("time") = now()
'adsrss("ip") = getip
'adsrss("class") = 1
'adsrss.update
'adsrss.close
'set adsrss=nothing
adsrs.close
set adsrs=nothing
adsconn.close
set adsconn=nothing
%>