<!--#include file="z_adv_conn.asp"-->
<%
	set rs_adv=server.createobject("adodb.recordset")
	sql_adv="select * from [adv_config] where adv_type='默认'"
	rs_adv.Open sql_adv,conn_adv,1,3
	if rs_adv.eof and rs_adv.bof then
		rs_adv.close
		set rs_adv=nothing
		response.redirect "http://www.99shik.cn/" '请改成你的地址
	else
		dim adv_url
		dim adv_cheat
		adv_url=rs_adv("adv_url")
		adv_cheat=rs_adv("adv_cheat")
		rs_adv("adv_click")=rs_adv("adv_click")+1
		rs_adv.update
		rs_adv.close	
		
		dim id
		dim sql_adv
		id = Request("get")
		if id<>"" then
			dim ip
			ip=Request.ServerVariables("REMOTE_ADDR")
			set rs_adv=server.createobject("adodb.recordset")
			sql_adv="select top 1 * from [adv_log] where userid="&id&" and guest_ip='"&ip&"' and clickdate>=dateadd('n',-"&adv_cheat&",now()) order by clickdate desc"
			Response.Write sql_adv
			rs_adv.Open sql_adv,conn_adv,1,3
			if rs_adv.eof and rs_adv.bof then
				rs_adv.addnew
				rs_adv("userid")=id
				rs_adv("guest_ip")=ip
				rs_adv("clickdate")=now()
				rs_adv("lx")="默认"
				rs_adv.update
				rs_adv.close
				sql_adv="update adv_broker set count_b=count_b+1 where userid="&id
				conn_adv.execute (sql_adv)
				sql_adv="update adv_broker set count_z=count_z+1 where userid="&id
				conn_adv.execute (sql_adv)
				sql_adv="update adv_config set adv_click1=adv_click1+1 where adv_type='默认'"
				conn_adv.execute (sql_adv)
				conn_adv.close
			end if
		end if

		response.redirect adv_url
	end if
		
%>