<% Response.Expires=0 come=request.querystring("like") '--------- ROTAZIONE Dim Conn Set Conn = Server.CreateObject("ADODB.Connection") conn.Open myConn if come="rotazione" then Dim rs set rs=Server.CreateObject("adodb.recordset") SQL="SELECT * FROM banner where utente <> 'default' and ((tothits < maxhits or maxhits=0) and (totClick < maxClick or maxclick=0)) and Datediff('d',"& Date() &", endData)>0" rs.open SQL, Conn, 3,3 '--------- NESSUN BANNER if rs.recordcount="0" then set rs=Server.CreateObject("adodb.recordset") SQL="SELECT * FROM banner where utente='default'" rs.open SQL, Conn, 3,3 %> document.write("<% response.write (replace(rs("alt"),"'>") <% rs.close set rs=nothing conn.close set conn=nothing response.end end if Dim totpeso totpeso=0 do while not rs.eof totpeso=totpeso+rs("peso") rs.movenext loop Randomize() Dim numerobanner numerobanner=Int((totpeso*Rnd)+1) Dim numerello numerello=0 rs.movefirst do while numerello+rs("peso") < numerobanner numerello=numerello+rs("peso") rs.movenext loop %> document.write("<% response.write (replace(rs("alt"),"'>") <% 'Aumento di uno il numero di impression relative al banner mostrato dim newhits newhits = rs.Fields("tothits")+ 1 rs.Fields("tothits")= newhits rs.update rs.close set rs=nothing conn.close set conn=nothing end if '--------- FISSO if come="fisso" then set rs=Server.CreateObject("adodb.recordset") SQL="SELECT * FROM banner where fisso='si'" rs.open SQL, Conn,3,3 if rs.recordcount<>"0" then %> document.write("<% response.write (replace(rs("alt"),"'>") <% newhits = rs.Fields("tothits")+ 1 rs.Fields("tothits")= newhits rs.update end if rs.close set rs=nothing conn.close set conn=nothing end if '--------- DEFAULT if come="default" then set rs=Server.CreateObject("adodb.recordset") SQL="SELECT * FROM banner where utente='default'" rs.open SQL, Conn, 3,3 Dim destinazione destinazione=rs("immagine") rs.close set rs=nothing conn.close set conn=nothing response.redirect destinazione end if %>