<%
Response.contentType="application/xml"
Response.Expires=0
Response.write "<?xml version=""1.0"" encoding=""utf-8""?>"
%>
<%
Const C_Site_WebUrl = "http://www.oblog.com.cn/"
COnst C_Is_SqlData=0
'----------------------------------------------
'文件名称:sitemap.asp
'用辿 for google sitemap
'----------------------------------------------
'On Error Resume Next
Dim rst,lCount,conn

Dim i

Call OpenConn
Set rst = Server.CreateObject("ADODB.Recordset")

rst.Open "select Top 100 logfile,addtime From oblog_log Where logfile<>'' and isdel=0 and isdraft=0 and ishide=0 and passcheck=1 Order By logid Desc" ,conn,1,3

lCount=rst.RecordCount
%>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
  <%
  For i=0 To lCount-1
	%>
  <url>
    <loc><%= C_Site_WebUrl & rst(0) %></loc>
    <lastmod><%=FormatTime(rst(1),1)%></lastmod>
    <changefreq>daily</changefreq>
    <priority>1.0</priority>
  </url>
  <%
  rst.MoveNext
 Next
%>
</urlset>
<%
rst.close
Set rst = Nothing

CloseConn


Sub OpenConn()
	Dim Sql_DBServer,Sql_DBName,Sql_User,Sql_Password,db,ConnStr
	If C_Is_Sqldata=0 Then
		db =    "/data/oblog45.mdb"
		ConnStr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & Server.MapPath(db)
	Else
		'Sql数据库连接参数:连接名(本地用local,外地用IP)$数据库名$用户名$用户密码
		Sql_DBServer	= "aobo"		'连接名(本地用(local),外地用IP如：127.0.0.1)
		Sql_DBName		= "oblog41"		'数据库名
		Sql_User		= "sa"			'访问数据的用户名
		Sql_Password	= "555555"

		ConnStr = "Provider = Sqloledb; User ID = " & Sql_User & "; Password = " & Sql_Password & "; Initial Catalog = " & Sql_DBName & "; Data Source = " & Sql_DBServer & ";"
	End If
	On Error Resume Next
	Set conn = Server.CreateObject("ADODB.Connection")
	conn.open ConnStr
End Sub

Sub CloseConn()
	On Error Resume Next
	conn.close
	Set conn = nothing
End Sub

Function FormatTime(sTime,iFmt)
	Dim sTemp
	If IsNull(sTime) Or sTime="" Then
		FormatTime=Year(Date) & "-"  & Right("0" & Month(Date),2) & "-" & Right("0" & Day(Date),2)
		Exit Function
	End If
	sTemp=Year(sTime) & "-" & Right("0" & Month(sTime),2) & "-" & Right("0" & Day(sTime),2)
	select Case iFmt
		Case 0
			FormatTime=sTemp
		Case 1
			FormatTime=sTemp& "T" &  Right("0" & Hour(sTime),2) & ":" &  Right("0" & Minute(sTime),2) & "+08:00"
	End select
End Function

%>

