<!--#include file="CONN.asp"-->
<!--#include file="../sd_site.asp"-->
<!--#include file="cookies.asp"-->
<head>
<%Server.ScriptTimeOut=3600%>
<%
dim diy,qb,qto
if JT=0 then
response.Write "<script LANGUAGE='javascript'>alert('未打开生成HTM设置！');window.location='sd_htmnto.asp';</script>"
response.end
end if
qb="sd_"
qto="sd_show.asp"
Function GetPage(url) 
dim Retrieval
Set Retrieval = CreateObject("Microsoft.XMLHTTP") 
With Retrieval 
.Open "Get", url, False ', "", "" 
.Send 
GetPage = BytesToBstr(.ResponseBody)
End With 
Set Retrieval = Nothing 
End Function

Function BytesToBstr(body)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = "GB2312"
BytesToBstr = objstream.ReadText 
objstream.Close
set objstream = nothing
End Function


dim strUrl,Item_Classid,id,FileName,FilePath,Do_Url,Html_Temp,row,rszhai

Action=Request("Action")
if Action="ok" then  
set rszhai=conn.execute("select * from sd_show where sd_shenhe=1 order by id desc")
elseif Action="Update" then
set rszhai=conn.execute("select * from sd_show where ID >= "&request("Bid")&" and ID <= "&request("Eid")&" and sd_shenhe=1 order by id desc")
elseif Action="Uptime" then
set rszhai=conn.execute("select * from sd_show where sd_shenhe=1 and datediff('d',sd_datas,now)<"&request("fd")&" order by sd_datas desc")
end if 
on error resume next      
		do while not rszhai.Eof
		Html_Temp="<UL>"   
		row=0
  Html_Temp   =   Html_Temp&"<LI>"   
  Item_Classid   = rszhai("id")   
  FileName   =   "/"&qb&""&Item_Classid&".htm"   
  FilePath   =   Server.MapPath("/")&"\"&FileName   
  Html_Temp   =   Html_Temp&FilePath&"</LI>"   
  Do_Url   =   "http://"   
  Do_Url   =   Do_Url&Request.ServerVariables("SERVER_NAME")&"/"&qto&""   
  Do_Url   =   Do_Url&"?id="&Item_Classid 
  strUrl   =   Do_Url   
  dim objXmlHttp
set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
objXmlHttp.open "GET",strUrl,false
objXmlHttp.send()
Dim binFileData
binFileData = objXmlHttp.responseBody
Dim objAdoStream
set objAdoStream = Server.CreateObject("ADODB.Stream")
objAdoStream.Type = 1
objAdoStream.Open()
objAdoStream.Write(binFileData)
objAdoStream.SaveToFile FilePath,2 
objAdoStream.Close()    
  Html_Temp   =   Html_Temp&"<UL>"   
  		rszhai.movenext
		row=row+1
		loop
		rszhai.close
response.write "<script language=""javascript"">"
response.write "  alert(""所有记录生成HTML完成！"")"
response.write "</script>"
Response.Write Html_Temp  
%>
<script type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>
<body onLoad="MM_goToURL('self','sd_htmnto.asp');return document.MM_returnValue">