<!--#include file="../Inc/conn.asp"-->
<!--#include file="admin_check.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
<title>admin</title>
<link href="Images/admin_css.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="<%=SitePath%>images/myfav.ico" type="image/x-icon" />
</head>
<body>
<p align="left" style="line-height:25px; font-size:14px;">
<font color="#000000"><b>注意：只有当您开启本站静态时，这里生成才有效果</b></font><br />
<font color="#0000FF"><b>点击生成网站商品静态：</b></font><br />
<a href="cp_html_1.asp?Sub=newshtml&pid=0">生成全部商品</a>　|　<a href="cp_html_2.asp?Sub=newshtml&pid=0">生成今日商品</a>　|　<a href="cp_html_3.asp">按ID号生成商品</a>
</p>


<%
Select Case Request("Sub")
Case "newshtml"
	
	'得到域名
	sqldomain="select * from Angel_asp_Config where ID=3"
	Set rsdomain= Server.CreateObject("ADODB.Recordset")
	rsdomain.open sqldomain,conn,3,3
	yuming=rsdomain("Value")
	
	
	kshijian=""&left(now(),10)&""
	
	'数据库中第一个ID
	sqlk="select top 1 * from Angel_asp_shop where DateAndTime like '%"&kshijian&"%'"
	Set rsk= Server.CreateObject("ADODB.Recordset")
	rsk.open sqlk,conn,3,3
	kaishi=rsk("ID")
	
	'数据库中最后一个ID
	sqlz="select top 1 * from Angel_asp_shop where DateAndTime like '%"&kshijian&"%' order by ID desc"
	Set rsz= Server.CreateObject("ADODB.Recordset")
	rsz.open sqlz,conn,3,3
	zuihou=rsz("ID")
	
	if request("pid")=0 then
	m=kaishi
	else
	m=request("pid")+1
	end if
	
	if m<=zuihou then
	
	Set rs= Server.CreateObject("ADODB.Recordset")
	sql="select * from Angel_asp_shop where ID="&m&""
	rs.open sql,conn,3,3
	dim http,reurl
	set http=Server.createobject("Microsoft."&chr(120)&"MLHTTP")
	Http.open "GET","http://"&yuming&"/cp.asp?ID="&rs("id")&"",false
	Http.send()
	set objStream = Server.CreateObject("ADODB.Stream")
	objStream.type = 1
	objStream.open
	objstream.write http.responseBody
	objstream.saveToFile server.mappath("../cp_"&rs("id")&".html"),2
	response.Write "../cp_"&rs("id")&".html 生成成功！<br>"
	response.write"<Script Language=Javascript>location.href='cp_html_2.asp?Sub=newshtml&pid="&m&"';</Script>"
	rs.close

	else
	response.Write "全部生成成功！总生成"&(zuihou-kaishi)&"个<br>"
	end if

	
	
End Select
%>
</body>
</html>