<!--#include file="utf-8.asp" -->
<!--#include file="js/Function.asp" -->
<!--#include file="CheckAdmin.asp" -->
<%

		'版权：世纪伟成(http://yidacms.com)
		'本信息不会影响您网站的正常访问，无论免费用户或是收费用户请保留这里的信息.
		'如果您删除了这里的版权信息,将追究法律责任.
		session("count")=0
		
		strURL = sw_dizhi '& request.servervariables("HTTP_HOST") & _
		'left(request.servervariables("SCRIPT_NAME"),len(request.servervariables("SCRIPT_NAME"))-len("/sitemap.asp"))
		strURL=replace(lcase(strURL),"admin_sitemap.asp","")
		
		dim foolcat
		foolcat = foolcat + "<?xml version=""1.0"" encoding=""UTF-8""?>"
		foolcat = foolcat + "<!--Google Site Map File Generated by http://yidacms.com " & return_RFC822_Date(now,"GMT") & "-->"
		foolcat = foolcat + "<urlset xmlns=""http://www.google.com/schemas/sitemap/0.84"">"
		foolcat = foolcat + "<url>"
		foolcat = foolcat + "<loc>" & strURL & "/</loc> "
		foolcat = foolcat + "</url>"
		session("count")=session("count")+"1"
		set all_fs = Server.CreateObject("Scripting.FileSystemObject")
		set all_folder = all_fs.GetFolder(server.MapPath("/"))
		set all_files = all_folder.files
		for each file in all_files
		foolcat = foolcat + "<url>"
		foolcat = foolcat + "<loc>" & strURL & "" & File.Name & "</loc> "
		foolcat = foolcat + "</url>"
		session("count")=session("count")+"1"
		next
		set rs = server.CreateObject("ADODB.RecordSet")
		sql = "select * from [shuaiweb_products] order by id asc"  
		rs.open sql,dbok,1,1
		do while not rs.eof
		id = rs("id")  
		foolcat = foolcat + "<url>"
		foolcat = foolcat + "<loc>" & strURL & "zh_products_view.asp?Id=" & id & "</loc> "
		foolcat = foolcat + "</url>"
		session("count")=session("count")+"1"
		rs.movenext
		loop
		rs.close
		set rs = nothing
		set rs = server.CreateObject("ADODB.RecordSet")
		sql = "select * from [shuaiweb_news] order by id asc"  
		rs.open sql,dbok,1,1
		do while not rs.eof
		id= rs("id") 
		foolcat = foolcat + "<url>"
		foolcat = foolcat + "<loc>" & strURL & "zh_news_view.asp?Id=" & id & "</loc> " 
		foolcat = foolcat + "</url>"
		session("count")=session("count")+"1"
		rs.movenext
		loop
		rs.close
		set rs = nothing
		set rs = server.CreateObject("ADODB.RecordSet")
		sql = "select * from [shuaiweb_co] order by id asc" 
		rs.open sql,dbok,1,1
		do while not rs.eof
		id= rs("id")
		foolcat = foolcat + "<url>"
		foolcat = foolcat + "<loc>" & strURL & "zh_about.asp?id=" & id & "</loc> "  
		foolcat = foolcat + "</url>"
		session("count")=session("count")+"1"
		rs.movenext
		loop
		rs.close
		set rs = nothing
		foolcat = foolcat + "</urlset>" 
		foolcat = "" + foolcat + ""
		foolcat = "" & foolcat & ""
		FolderPath = Server.MapPath("/")
		Set fso = Server.CreateObject("Scripting.FileSystemObject")
		Set fout = fso.CreateTextFile(FolderPath&"\sitemap.xml")
		fout.writeLine foolcat
		fout.close
		set fout = nothing
		Function return_RFC822_Date(byVal myDate, byVal TimeZone)
		Dim myDay, myDays, myMonth, myYear
		Dim myHours, myMinutes, mySeconds
		myDate = CDate(myDate)
		myDay = EnWeekDayName(myDate)
		myDays = Right("00" & Day(myDate),2)
		myMonth = EnMonthName(myDate)
		myYear = Year(myDate)
		myHours = Right("00" & Hour(myDate),2)
		myMinutes = Right("00" & Minute(myDate),2)
		mySeconds = Right("00" & Second(myDate),2)
		return_RFC822_Date = myDay&", "& _
		myDays&" "& _
		myMonth&" "& _ 
		myYear&" "& _
		myHours&":"& _
		myMinutes&":"& _
		mySeconds&" "& _ 
		" " & TimeZone
		End Function 
		Function EnWeekDayName(InputDate)
		Dim Result
		Select Case WeekDay(InputDate,1)
		Case 1:Result="Sun"
		Case 2:Result="Mon"
		Case 3:Result="Tue"
		Case 4:Result="Wed"
		Case 5:Result="Thu"
		Case 6:Result="Fri"
		Case 7:Result="Sat"
		End Select
		EnWeekDayName = Result
		End Function
		Function EnMonthName(InputDate)
		Dim Result
		Select Case Month(InputDate)
		Case 1:Result="Jan"
		Case 2:Result="Feb"
		Case 3:Result="Mar"
		Case 4:Result="Apr"
		Case 5:Result="May"
		Case 6:Result="Jun"
		Case 7:Result="Jul"
		Case 8:Result="Aug"
		Case 9:Result="Sep"
		Case 10:Result="Oct"
		Case 11:Result="Nov"
		Case 12:Result="Dec"
		End Select
		EnMonthName = Result
		End Function 
%>
		<table width="98%" border="1"cellpadding="6" cellspacing="0" bordercolor="#666666" style="border-collapse:collapse; font-size:12px;" bgcolor="#FFFFFF" align="center">
		  <tr>
			<td>&nbsp;sitemap.xml生成完毕，共生成<%=session("count")%>个文件，点击查看<a href="../sitemap.xml" target="_blank">sitemap.xml</a>文件。</td>
		  </tr>
		</table>