<!--#include file="Conn.asp"--><%
Checklogin("")

Act = Request.QueryString("act")
If act="making" Then

'******生成路径
xmlPath = "/" & Request.Form("xmlpath")
addrs=0
starttime = Now()
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set xmlWrite=fso.CreateTextFile(Server.MapPath(xmlPath),true)

modStr = FormatTime(Now(),"yyyy-mm-dd")

strOut = "<?xml version=""1.0"" encoding=""UTF-8""?>" & CHR(13)
strOut = strOut & "<urlset>" & CHR(13)


Set Rs=Server.CreateObject("ADODB.RecordSet")
Set Rs1=Server.CreateObject("ADODB.RecordSet")
Set Rs2=Server.CreateObject("ADODB.RecordSet")
Set Rs3=Server.CreateObject("ADODB.RecordSet")
Set Rs4=Server.CreateObject("ADODB.RecordSet")


'*********** 首页 ***********
strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"/</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>daily</changefreq>" & CHR(13)
strOut = strOut & "		<priority>1.0</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1


'*********** 导航·产品大全 ***********
strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/pl.asp</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>daily</changefreq>" & CHR(13)
strOut = strOut & "		<priority>0.8</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1

'*********** 导航·下载 ***********
strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/dl.asp</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>weekly</changefreq>" & CHR(13)
strOut = strOut & "		<priority>0.5</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1

'*********** 导航·行业解决方案 ***********
strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/yl.asp</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>weekly</changefreq>" & CHR(13)
strOut = strOut & "		<priority>0.8</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1

'*********** 导航·常见问题 ***********
strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/qa.asp</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>weekly</changefreq>" & CHR(13)
strOut = strOut & "		<priority>0.6</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1

'*********** 导航·售后服务 ***********
strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/sh.asp</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>monthly</changefreq>" & CHR(13)
strOut = strOut & "		<priority>0.5</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1

'*********** 导航·联系我们 ***********
strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/ct.asp</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>monthly</changefreq>" & CHR(13)
strOut = strOut & "		<priority>0.5</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1


'*********** 单页列表 ***********
Rs.Open "Select id From pages Where pagesstate>0 AND id>2 Order By id",Conn,1,1
Do While Not Rs.Bof And Not Rs.Eof

strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/g.asp?id="& Rs("id") &"</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>monthly</changefreq>" & CHR(13)
strOut = strOut & "		<priority>0.5</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1

Rs.MoveNext
Loop
Rs.Close


'*********** 行业解决方案页数 ***********
Rs.Open "Select id From info Where classid=2 AND infostate>0 Order By id",Conn,1,1
Rs.PageSize = 9
If Rs.PageCount > 1 Then
	For i=1 To Rs.PageCount
		strOut = strOut & "	<url>" & CHR(13)
		strOut = strOut & "		<loc>"& weburl &"/yl.asp?Page="& i &"</loc>" & CHR(13)
		strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
		strOut = strOut & "		<changefreq>weekly</changefreq>" & CHR(13)
		strOut = strOut & "		<priority>0.8</priority>" & CHR(13)
		strOut = strOut & "	</url>" & CHR(13)
		addrs = addrs + 1
	Next
End If
Rs.Close


'*********** 行业解决方案列表 ***********
Rs.Open "Select id From info Where classid=2 AND infostate>0 Order By id",Conn,1,1
Do While Not Rs.Bof And Not Rs.Eof

strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/ylc.asp?id="& Rs("id") &"</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>weekly</changefreq>" & CHR(13)
strOut = strOut & "		<priority>0.8</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1

Rs.MoveNext
Loop
Rs.Close

'*********** 常见问题页数 ***********
Rs.Open "Select id From info Where classid=1 AND infostate>0 Order By id",Conn,1,1
Rs.PageSize = 9
If Rs.PageCount > 1 Then
	For i=1 To Rs.PageCount
		strOut = strOut & "	<url>" & CHR(13)
		strOut = strOut & "		<loc>"& weburl &"/qa.asp?Page="& i &"</loc>" & CHR(13)
		strOut = strOut & "		<lastmod>"& weekly &"</lastmod>" & CHR(13)
		strOut = strOut & "		<changefreq>daily</changefreq>" & CHR(13)
		strOut = strOut & "		<priority>0.6</priority>" & CHR(13)
		strOut = strOut & "	</url>" & CHR(13)
		addrs = addrs + 1
	Next
End If
Rs.Close

'*********** 常见问题列表 ***********
Rs.Open "Select id From info Where classid=1 AND infostate>0 Order By id",Conn,1,1
Do While Not Rs.Bof And Not Rs.Eof

strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/qac.asp?id="& Rs("id") &"</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>weekly</changefreq>" & CHR(13)
strOut = strOut & "		<priority>0.6</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1

Rs.MoveNext
Loop
Rs.Close


'*********** 信息分类 ***********
Rs1.Open "Select id From class Where classstate>0 AND id>2 Order By id",Conn,1,1
Do While Not Rs1.Bof And Not Rs1.Eof

	strOut = strOut & "	<url>" & CHR(13)
	strOut = strOut & "		<loc>"& weburl &"/info.asp?cid="& Rs1("id") &"</loc>" & CHR(13)
	strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
	strOut = strOut & "		<changefreq>daily</changefreq>" & CHR(13)
	strOut = strOut & "		<priority>0.4</priority>" & CHR(13)
	strOut = strOut & "	</url>" & CHR(13)
	addrs = addrs + 1

	'*********** 信息分类页数 ***********
	Rs.Open "Select id From info Where classid="& Rs1("id") &" AND infostate>0 Order By id",Conn,1,1
	Rs.PageSize = 9
	If Rs.PageCount > 1 Then
		For i=1 To Rs.PageCount
			strOut = strOut & "	<url>" & CHR(13)
			strOut = strOut & "		<loc>"& weburl &"/info.asp?cid="& Rs1("id") &"&Page="& i &"</loc>" & CHR(13)
			strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
			strOut = strOut & "		<changefreq>daily</changefreq>" & CHR(13)
			strOut = strOut & "		<priority>0.4</priority>" & CHR(13)
			strOut = strOut & "	</url>" & CHR(13)
			addrs = addrs + 1
		Next
	End If
	Rs.Close

Rs1.MoveNext
Loop
Rs1.Close


'*********** 信息列表 ***********
Rs.Open "Select id From info Where classid>2 AND infostate>0 Order By id",Conn,1,1
Do While Not Rs.Bof And Not Rs.Eof

strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/rd.asp?id="& Rs("id") &"</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>daily</changefreq>" & CHR(13)
strOut = strOut & "		<priority>0.4</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1

Rs.MoveNext
Loop
Rs.Close


'*********** 产品列表 ***********
Rs.Open "Select id From cp Where cpstate>0 Order By id",Conn,1,1
Do While Not Rs.Bof And Not Rs.Eof

strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/p.asp?id="& Rs("id") &"</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>weekly</changefreq>" & CHR(13)
strOut = strOut & "		<priority>0.8</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1

Rs.MoveNext
Loop
Rs.Close


'*********** 产品标签 ***********
tempTagList="||"
Rs.Open "Select tags From cp Where cpstate>0 Order By id",Conn,1,1
Do While Not Rs.Bof And Not Rs.Eof

	tags = Split(Rs("tags"),"&#124;")

	For ti = 0 To UBound(tags)
		If tags(ti)<>"" AND Instr(tempTagList,"||"& tags(ti) &"||")<=0 Then
			tempTagList = tempTagList & tags(ti) & "||"

			strOut = strOut & "	<url>" & CHR(13)
			strOut = strOut & "		<loc>"& weburl &"/t.asp?t="&Server.URLEnCode(tags(ti))&"</loc>" & CHR(13)
			strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
			strOut = strOut & "		<changefreq>daily</changefreq>" & CHR(13)
			strOut = strOut & "		<priority>0.4</priority>" & CHR(13)
			strOut = strOut & "	</url>" & CHR(13)
			addrs = addrs + 1

		End If
	Next

Rs.MoveNext
Loop
Rs.Close


'*********** 品牌专区·品牌 ***********
Rs.Open "Select id From pp Where ppstate>0 Order By id",Conn,1,1
Do While Not Rs.Bof And Not Rs.Eof

strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/pl.asp?ppid="& Rs("id") &"</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>monthly</changefreq>" & CHR(13)
strOut = strOut & "		<priority>0.8</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1

	'取得页数
	Rs1.Open "Select id From cp WHERE ppid="& Rs("id") &" AND cpstate>0",Conn,1,1
	Rs1.PageSize = 9
	If Rs1.PageCount > 1 Then
		For i=2 To Rs1.PageCount
			
			strOut = strOut & "	<url>" & CHR(13)
			strOut = strOut & "		<loc>"& weburl &"/pl.asp?ppid="& Rs("id") &"&Page="& i &"</loc>" & CHR(13)
			strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
			strOut = strOut & "		<changefreq>monthly</changefreq>" & CHR(13)
			strOut = strOut & "		<priority>0.8</priority>" & CHR(13)
			strOut = strOut & "	</url>" & CHR(13)
			addrs = addrs + 1

		Next
	End If
	Rs1.Close

Rs.MoveNext
Loop
Rs.Close



'*********** 品牌专区·应用 ***********
Rs.Open "Select id From cpyy Where yystate>0 Order By id",Conn,1,1
Do While Not Rs.Bof And Not Rs.Eof

strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/pl.asp?yyid="& Rs("id") &"</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>monthly</changefreq>" & CHR(13)
strOut = strOut & "		<priority>0.8</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1

	'取得页数
	Rs1.Open "Select id From cp WHERE yyid="& Rs("id") &" AND cpstate>0",Conn,1,1
	Rs1.PageSize = 9
	If Rs1.PageCount > 1 Then
		For i=2 To Rs1.PageCount
			
			strOut = strOut & "	<url>" & CHR(13)
			strOut = strOut & "		<loc>"& weburl &"/pl.asp?yyid="& Rs("id") &"&Page="& i &"</loc>" & CHR(13)
			strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
			strOut = strOut & "		<changefreq>monthly</changefreq>" & CHR(13)
			strOut = strOut & "		<priority>0.8</priority>" & CHR(13)
			strOut = strOut & "	</url>" & CHR(13)
			addrs = addrs + 1

		Next
	End If
	Rs1.Close

Rs.MoveNext
Loop
Rs.Close


'*********** 品牌专区·行业 ***********
Rs.Open "Select id From hy Order By id",Conn,1,1
Do While Not Rs.Bof And Not Rs.Eof

strOut = strOut & "	<url>" & CHR(13)
strOut = strOut & "		<loc>"& weburl &"/pl.asp?hyid="& Rs("id") &"</loc>" & CHR(13)
strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
strOut = strOut & "		<changefreq>monthly</changefreq>" & CHR(13)
strOut = strOut & "		<priority>0.8</priority>" & CHR(13)
strOut = strOut & "	</url>" & CHR(13)
addrs = addrs + 1

	'取得页数
	Rs1.Open "Select id From cp WHERE hyid like '%,"& Rs("id") &",%' AND cpstate>0",Conn,1,1
	Rs1.PageSize = 9
	If Rs1.PageCount > 1 Then
		For i=2 To Rs1.PageCount
			
			strOut = strOut & "	<url>" & CHR(13)
			strOut = strOut & "		<loc>"& weburl &"/pl.asp?hyid="& Rs("id") &"&Page="& i &"</loc>" & CHR(13)
			strOut = strOut & "		<lastmod>"& modStr &"</lastmod>" & CHR(13)
			strOut = strOut & "		<changefreq>monthly</changefreq>" & CHR(13)
			strOut = strOut & "		<priority>0.8</priority>" & CHR(13)
			strOut = strOut & "	</url>" & CHR(13)
			addrs = addrs + 1

		Next
	End If
	Rs1.Close

Rs.MoveNext
Loop
Rs.Close


strOut = strOut & "</urlset>"

xmlWrite.WriteLine strOut
xmlWrite.Close
Set xmlWrite=Nothing
Set fso=Nothing




Set Rs=Nothing
Set Rs1=Nothing
Set Rs2=Nothing
Set Rs3=Nothing
Set Rs4=Nothing
Conn.Close:Set Conn=Nothing
Response.Write "<p style=""font-size:14px;line-height:180%;color:green;font-family:'微软雅黑'"">生成成功，共 "& addrs &" 条记录，耗时："& DateDiff("s",starttime,Now()) &" 秒。<br /><a href="""& xmlPath &""" target=""_blank"">点击查看</a><br /><a href=""?"">返回</a></p>"
Response.End
End If

%><!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理区域</title>
<link rel="stylesheet" href="css/common.css" type="text/css" />
<script language="javascript" src="../js/jquery-1.6.1.min.js"></script>
<script>
function making(){
	if(!confirm('确定要生成？')){return false}
	$("#btn1").attr("disabled","disabled");
	$("#msg").html('正在努力生成，请稍候 - - - ');
}
</script>
</head>
<body>
<div id="man_zone">
<form method="post" action="?act=making" onSubmit="return making()">
<p>说明：文件保存在网站根目录</p>
<input type="text" name="xmlpath" value="sitemap.xml" />
<input type="submit" value="点击生成百度地图" id="btn1" />
<div id="msg" style="color:red;font-size:18px;font-family:'微软雅黑','黑体';padding:20px"></div>
</form>
</body>
</html><%Conn.Close:Set Conn=Nothing%>
