<!--#include file="../lib/base.asp"-->
<!--#include file="../theme.asp"-->
<%
''' EYCMS 广告
''' ==================================================================
	eycms.stophack
	dim id:id=eycms.getint(eycms.fget("id",0),0)
	dim code
	if id=0 then
		code="&#26080;&#25928;&#30340;&#35843;&#29992;"
	else
		if eycms.checkcache("plug_ad_"&id,0) then
			code=eycms.loadcache("plug_ad_"&id,0)
		else
			code=loadad(id)
			eycms.setcache "plug_ad_"&id,code,0
		end if
	end if
	eycms.echo deal_code(code)
	eycms.db.dbclose
	
	function loadad(byval t0)
		dim datadb,thisdata
		datadb=eycms.db.dbload("","begindate,overdate,code,note","ey_expand_ad","id="&id&"","")
		if ubound(datadb)<0 then
			loadad="&#26080;&#25928;&#30340;&#35843;&#29992;"
		else
			thisdata=date()
			if thisdata>=datadb(0,0) and thisdata<=datadb(1,0) then
				loadad=datadb(2,0)
			else
				loadad=datadb(3,0)
			end if
		end if
	end function
	
	function deal_code(byval t0)
		t0=replace(t0,"""","\""")
		dim arr:arr=split(t0,vbcrlf)
		dim j,h
		for j=0 to ubound(arr)
			if arr(j)<>"" then
				h=h&"document.writeln("""&arr(j)&""");"
				if j<>ubound(arr) then h=h&vbcrlf
			end if
		next
		deal_code=h
	end function 
%>
