六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

直接生成XML的Google SiteMap代碼[ASP版本]

[摘要]ASP版本,需要空間的FSO支持使用方法就不說了版主覺的可以,給個精第一次哦 CODE: [Copy to clipboard] <%Server.ScriptTimeout=50000' sitemap_gen.asp' A simple script to auto...
ASP版本,需要空間的FSO支持
使用方法就不說了

版主覺的可以,給個精
第一次哦


  CODE: [Copy to clipboard]   
<%
Server.ScriptTimeout=50000
' sitemap_gen.asp
' A simple script to automatically produce sitemaps for a webserver, in the Google Sitemap Protocol (GSP)
' by Francesco Passantino
' www.iteam5.net/francesco/sitemap
' v0.2 released 5 june 2005 (Listing a directory tree recursively improvement)
'
' BSD 2.0 license,
' http://www.opensource.org/licenses/bsd-license.php
' 收集整理:        重慶森林@im286.com


session("server")="http://192.168.0.111"                '你的域名
vDir = "/"                                               '制作SiteMap的目錄,相對目錄(相對于根目錄而言)


set objfso = CreateObject("Scripting.FileSystemObject")
root = Server.MapPath(vDir)

'response.ContentType = "text/xml"
'response.write "<?xml version='1.0' encoding='UTF-8'?>"
'response.write "<urlset xmlns='http://www.google.com/schemas/sitemap/0.84'>"

str = "<?xml version='1.0' encoding='UTF-8'?>" & vbcrlf
str = str & "<urlset xmlns='http://www.google.com/schemas/sitemap/0.84'>" & vbcrlf

Set objFolder = objFSO.GetFolder(root)
'response.write getfilelink(objFolder.Path,objFolder.dateLastModified)
Set colFiles = objFolder.Files
For Each objFile In colFiles
        'response.write getfilelink(objFile.Path,objfile.dateLastModified)
        str = str & getfilelink(objFile.Path,objfile.dateLastModified) & vbcrlf
Next
ShowSubFolders(objFolder)

'response.write "</urlset>"
str = str & "</urlset>" & vbcrlf
set fso = nothing

Set objStream = Server.CreateObject("ADODB.Stream")
    With objStream
    '.Type = adTypeText
    '.Mode = adModeReadWrite
    .Open
    .Charset = "utf-8"
    .Position = objStream.Size
    .WriteText=str
    .SaveToFile server.mappath("/sitemap.xml"),2 '生成的XML文件名
    .Close
    End With

  Set objStream = Nothing
  If Not Err Then
    Response.Write("<script>alert('成功生成站點地圖!');history.back();</script>")
    Response.End
  End If

Sub ShowSubFolders(objFolder)
        Set colFolders = objFolder.SubFolders
        For Each objSubFolder In colFolders
                if folderpermission(objSubFolder.Path) then
                        'response.write getfilelink(objSubFolder.Path,objSubFolder.dateLastModified)
                        str = str & getfilelink(objSubFolder.Path,objSubFolder.dateLastModified) & vbcrlf
                        Set colFiles = objSubFolder.Files
                        For Each objFile In colFiles
                                'response.write getfilelink(objFile.Path,objFile.dateLastModified)
                                str = str & getfilelink(objFile.Path,objFile.dateLastModified) & vbcrlf
                        Next
                        ShowSubFolders(objSubFolder)
                end if
        Next
End Sub


Function getfilelink(file,datafile)
        file=replace(file,root,"")
        file=replace(file,"\","/")
        If FileExtensionIsBad(file) then Exit Function
        if month(datafile)<10 then filedatem="0"
        if day(datafile)<10 then filedated="0"
        filedate=year(datafile)&"-"&filedatem&month(datafile)&"-"&filedated&day(datafile)
        getfilelink = "<url><loc>"&server.htmlencode(session("server")&vDir&file)&"</loc><lastmod>"&filedate&"</lastmod><changefreq>daily</changefreq><priority>1.0</priority></url>"
        Response.Flush
End Function


Function Folderpermission(pathName)

        '需要過濾的目錄(不列在SiteMap里面)
        PathExclusion=Array("\temp","\_vti_cnf","_vti_pvt","_vti_log","cgi-bin","\admin","\edu")
        Folderpermission =True
        for each PathExcluded in PathExclusion
                if instr(ucase(pathName),ucase(PathExcluded))>0 then
                        Folderpermission = False
                        exit for
                end if
        next
End Function


Function FileExtensionIsBad(sFileName)
        Dim sFileExtension, bFileExtensionIsValid, sFileExt
        'modify for your file extension (http://www.googleguide.com/file_type.html)
        Extensions = Array("png","gif","jpg","jpeg","zip","pdf","ps","html","htm","php","wk1","wk2","wk3","wk4","wk5","wki","wks","wku","lwp","mw","xls","ppt","doc","swf","wks","wps","wdb","wri","rtf","ans","txt")
'設置列表的文件名,擴展名不在其中的話SiteMap則不會收錄該擴展名的文件

        if len(trim(sFileName)) = 0 then
                FileExtensionIsBad = true
                Exit Function
        end if

        sFileExtension = right(sFileName, len(sFileName) - instrrev(sFileName, "."))
        bFileExtensionIsValid = false        'assume extension is bad
        for each sFileExt in extensions
                if ucase(sFileExt) = ucase(sFileExtension) then
                        bFileExtensionIsValid = True
                        exit for
                end if
        next
        FileExtensionIsBad = not bFileExtensionIsValid
End Function
%>








主站蜘蛛池模板: 收集最新中文国产中文字幕 | 亚洲欧美香蕉在线日韩精选 | 视频在线一区二区 | 天美传媒精品一区 | 色色网视频 | 欲香欲色| 亚洲第一男人网站 | 午夜视频1000部免费看 | 欧美亚洲国产日韩 | 青娱乐福利| 伊人青青久久 | 四虎永久在线免费观看 | 亚洲高清视频在线 | 婷婷综合丁香 | 青青热久久国产久精品 | 青春久久| 中文字幕日韩一区二区不卡 | 一级黄色免费片 | 情不自禁完整版在线观看免费 | 亚洲第一网站快活影院 | 四虎在线最新永久免费播放 | 午夜影视在线观看免费完整高清大全 | 色色就色色 | 天天操天天插天天射 | 午夜视频导航 | 天天摸天天操 | 日韩亚洲制服丝袜中文字幕 | 五月激情综合婷婷 | 亚洲专区路线一路线二 | 亚洲成a人片在线观看中文动漫 | 我的秘密饭店 电视剧免费观看 | 亚洲日本欧美产综合在线 | 婷婷狠狠干| 四虎国产精品影库永久免费 | 一级片久久 | 四虎在线视频 | 天美视频在线观看 | 香蕉福利久久福利久久香蕉 | 亚洲大片免费看 | 午夜小视频免费观看 | 倩女还魂在线观看完整版免费 |