<%@ TRANSACTION = Required %>
<%
On Error Resume Next
response.ContentType="text/html"
response.Charset="gb2312"
dim act,id
act=request.QueryString("act")
if not isEmpty(request.QueryString("id")) then
	id=Clng(request.QueryString("id"))
else
	id=1
end if
if isempty(application("expireTime")) then
	application.Lock()
	application("expireTime")=DateAdd("s",30,now)
	application.UnLock()
end if
if(CDate(application("expireTime"))<now) then
	'response.Write("add xml")'记录到服务器文件
	Set fs=Server.CreateObject("Scripting.FileSystemObject")
	Set file_w = fs.CreateTextFile(server.mappath("live/"&date&"_"&id&".txt"),true)	
	file_w.WriteLine(application("msg"&id))
	If Err Then
    	ObjectContext.SetAbort 
	Else
    	ObjectContext.SetComplete
	End If

	file_w.close
	set file_w=nothing
	set fs=nothing
	application.Lock()
	application("expireTime")=DateAdd("s",30,now)
	application.UnLock()
end if
if(application("msg"&id)<>"") then
	response.Write(application("msg"&id))
else
	Set fs=Server.CreateObject("Scripting.FileSystemObject")
	set file_r = fs.opentextfile(server.mappath("live/"&date&"_"&id&".txt"),1,True)'读取模板文件
	application.Lock()
	application("msg"&id)= file_r.ReadAll
	application.UnLock()	
	If Err Then
    	ObjectContext.SetAbort 
	Else
    	ObjectContext.SetComplete
	End If
	file_r.close()
	set file_r=nothing
	set fs=nothing
	response.Write(application("msg"&id))
end if
Sub OnTransactionAbort
	Response.Write "直播还没有开始..."
End Sub
Sub OnTransactionCommit

End Sub

%>