class blogwrite
dim blogfsowrite
Private Sub Class_Initialize
set blogfsowrite=new blogfso
end sub
function blogsetup( blogname1,blogfolder1,blogxsltvalue,shownumpage1,sourcef)
dim theyear,themonth
xmlstr="<?xml version='1.0' encoding='gb2312' ?>"
xmlstr=xmlstr & "<blogbasicinfo>"
xmlstr=xmlstr & "<blogname>"
xmlstr=xmlstr & blogname1
xmlstr=xmlstr & "</blogname>"
xmlstr=xmlstr & "<blogfolder>"
xmlstr=xmlstr & blogfolder1
xmlstr=xmlstr & "</blogfolder>"
xmlstr=xmlstr & "<blogxsltname>"
select case blogxsltvalue
case 1
xmlstr=xmlstr & "<blogxslt name='blueone' selected='yes'>" & blogfolder1 & "blueone.xsl" & "</blogxslt>"
end select
xmlstr=xmlstr & "</blogxsltname>"
xmlstr=xmlstr & "<blogindex>"
xmlstr=xmlstr & blogfolder1 & "index.htm"
xmlstr=xmlstr & "</blogindex>"
xmlstr=xmlstr & "<blogpagenumshow>"
xmlstr=xmlstr & shownumpage1
xmlstr=xmlstr & "</blogpagenumshow>"
xmlstr=xmlstr & "<blogstart>"
xmlstr=xmlstr & date
xmlstr=xmlstr & "</blogstart>"
xmlstr=xmlstr & "<blogall>"
xmlstr=xmlstr & "</blogall>"
xmlstr=xmlstr & "</blogbasicinfo>"
blogfsowrite.fsocreatef "c:/bloginfo.xml",1
blogfsowrite.fsowrite xmlstr,"c:/bloginfo.xml"
xmlstr="<?xml version='1.0' encoding='gb2312' ?>"
xmlstr=xmlstr & "<?xml-stylesheet type='text/xsl' href='blueone.xsl' ?>"
xmlstr=xmlstr & "<blogrecent>"
xmlstr=xmlstr & "</blogrecent>"
blogfsowrite.fsocreatef blogfolder1 & "blogrecent.xml",1
blogfsowrite.fsowrite xmlstr,blogfolder1 & "blogrecent.xml"
fsooprsrc=sourcef & "fsooperation.vbs"
fsooprdes=blogfolder1 & "fsooperation.vbs"
fsoblogwrsrc=sourcef & "blogwrite.vbs"
fsoblogwrdes=blogfolder1 & "blogwrite.vbs"
fsoxmlhttpsrc=sourcef & "xmlhttprequest.vbs"
fsoxmlhttpdes=blogfolder1 & "xmlhttprequest.vbs"
fsoblueonesrc=sourcef & "blueone.xsl"
fsoblueonedes=blogfolder1 & "blueone.xsl"
fsocalendarsrc=sourcef & "calendar.vbs"
fsocalendardes=blogfolder1 & "calendar.vbs"
fsoxmldomsrc=sourcef & "xmldom.vbs"
fsoxmldomdes=blogfolder1 & "xmldom.vbs"
fsoblogxmldomsrc=sourcef & "blogxmldom.vbs"
fsoblogxmldomdes=blogfolder1 & "blogxmldom.vbs"
fsomainsrc=sourcef & "main.vbs"
fsomaindes=blogfolder1 & "main.vbs"
fsoindexsrc=sourcef & "index.htm"
fsoindexdes=blogfolder1 & "index.htm"
blogfsowrite.fsocopyf fsooprsrc,fsooprdes,1
blogfsowrite.fsocopyf fsoblogwrsrc,fsoblogwrdes,1
blogfsowrite.fsocopyf fsoxmlhttpsrc,fsoxmlhttpdes,1
blogfsowrite.fsocopyf fsoblueonesrc,fsoblueonedes,1
blogfsowrite.fsocopyf fsocalendarsrc,fsocalendardes,1
blogfsowrite.fsocopyf fsoxmldomsrc,fsoxmldomdes,1
blogfsowrite.fsocopyf fsomainsrc,fsomaindes,1
blogfsowrite.fsocopyf fsoblogxmldomsrc,fsoblogxmldomdes,1
blogfsowrite.fsocopyf fsoindexsrc,fsoindexdes,1
end function
function newblog(blogtitle,blogcontent,blogshownum,blogfolder1)
xmlstr="<?xml version='1.0' encoding='gb2312' ?>"
xmlstr=xmlstr & "<blog date='"
xmlstr=xmlstr & date
xmlstr=xmlstr & "' time='"
xmlstr=xmlstr & time
xmlstr=xmlstr & "'>"
xmlstr=xmlstr & "<blogtitle>"
xmlstr=xmlstr & blogtitle
xmlstr=xmlstr & "</blogtitle>"
xmlstr=xmlstr & "<blogcontent>"
xmlstr=xmlstr & blogcontent
xmlstr=xmlstr & "</blogcontent>"
xmlstr=xmlstr & "<comment>"
xmlstr=xmlstr & "</comment>"
xmlstr=xmlstr & "</blog>"
datey=year(now())
datem=month(now())
dated=day(now())
dateh=hour(now())
datemin=minute(now())
dates=second(now())
random1=cint(rnd()*1000)
blogfilename=datey & datem & dated & dateh & datemin & dates & ".xml"
foldername=blogfolder1 & datey
flag=blogfsowrite.existsf(foldername,2)
blogfilename=blogfolder1 & datey & "/" & datem & "/" & blogfilename
if flag=2 then
blogfsowrite.fsocreatef foldername,2
blogfsowrite.fsocreatef foldername & "/" & datem & ".xml" ,1
foldername1=foldername & "/" & datem
xmlstr1="<?xml version='1.0' encoding='gb2312' ?>"
xmlstr1=xmlstr1 & "<blogmonth month='"
xmlstr1=xmlstr1 & datem
xmlstr1=xmlstr1 & "'>"
xmlstr1=xmlstr1 & "<blog date='"
xmlstr1=xmlstr1 & date
xmlstr1=xmlstr1 & "' time='"
xmlstr1=xmlstr1 & time
xmlstr1=xmlstr1 & "'>"
xmlstr1=xmlstr1 & "<blogtitle>"
xmlstr1=xmlstr1 & blogtitle
xmlstr1=xmlstr1 & "</blogtitle>"
xmlstr1=xmlstr1 & "<blogcontent>"
xmlstr1=xmlstr1 & blogcontent
xmlstr1=xmlstr1 & "</blogcontent>"
xmlstr1=xmlstr1 & "<link>"
xmlstr1=xmlstr1 & blogfilename
xmlstr1=xmlstr1 & "</link>"
xmlstr1=xmlstr1 & "<comment>"
xmlstr1=xmlstr1& "</comment>"
xmlstr1=xmlstr1 & "</blog>"
xmlstr1=xmlstr1 & "</blogmonth>"
blogfsowrite.fsocreatef foldername,2
blogfsowrite.fsowrite xmlstr1,foldername & "/" & datem & ".xml"
set blogrecxml=new xmldom
blogrecxml.openxml blogfolder1 & "blogrecent.xml"
blogrecxml.addrecentxml blogtitle,blogcontent,blogfilename,blogfolder1 & "blogrecent.xml",blogshownum
set blogmxml=nothing
flag=blogwrite.existsf(foldername1,2)
if flag=2 then
blogfsowrite.fsocreatef foldername1,2
end if
else
foldername1=foldername & "/" & datem & "/"
flag=blogfsowrite.existsf(foldername1,2)
if flag=2 then
blogfsowrite.fsocreatef foldername1,2
xmlstr1="<?xml version='1.0' encoding='gb2312' ?>"
xmlstr1=xmlstr1 & "<blogmonth month='"
xmlstr1=xmlstr1 & datem
xmlstr1=xmlstr1 & "'>"
xmlstr1=xmlstr1 & "<blog date='"
xmlstr1=xmlstr1 & date
xmlstr1=xmlstr1 & "' time='"
xmlstr1=xmlstr1 & time
xmlstr1=xmlstr1 & "'>"
xmlstr1=xmlstr1 & "<blogtitle>"
xmlstr1=xmlstr1 & blogtitle
xmlstr1=xmlstr1 & "</blogtitle>"
xmlstr1=xmlstr1 & "<blogcontent>"
xmlstr1=xmlstr1 & blogcontent
xmlstr1=xmlstr1 & "</blogcontent>"
xmlstr1=xmlstr1 & "<link>"
xmlstr1=xmlstr1 & blogfilename
xmlstr1=xmlstr1 & "</link>"
xmlstr1=xmlstr1 & "<comment>"
xmlstr1=xmlstr1& "</comment>"
xmlstr1=xmlstr1 & "</blog>"
xmlstr1=xmlstr1 & "</blogmonth>"
blogfsowrite.fsocreatef foldername & "/" & datem & ".xml",1
blogfsowrite.fsowrite xmlstr1,foldername & "/" & datem & ".xml"
set blogrecxml=new xmldom
blogrecxml.openxml folder1 & "blogrecent.xml"
blogrecxml.addrecentxml blogtitle,blogcontent,blogfilename,blogfolder1 & "blogrecent.xml",blogshownum
set blogmxml=nothing
else
set blogmxml=new xmldom
blogmxml.openxml foldername & "/" & datem & ".xml"
blogmxml.additemblogm blogtitle,blogcontent,blogfilename,foldername & "/" & datem & ".xml"
set blogmxml=nothing
set blogrecxml=new xmldom
blogrecxml.openxml blogfolder1 & "blogrecent.xml"
blogrecxml.addrecentxml blogtitle,blogcontent,blogfilename,blogfolder1 & "blogrecent.xml",blogshownum
set blogmxml=nothing
set blogbasxml=new xmldom
blogbasxml.openxml "c:/bloginfo.xml"
blogbasxml.ebloginfo blogtitle,blogfilename
set blogmxml=nothing
end if
end if
blogfsowrite.fsocreatef blogfilename,1
blogfsowrite.fsowrite xmlstr,blogfilename
end function
end class
class xmldom
dim thexmldom
Private Sub Class_Initialize
set thexmldom=createobject("Microsoft.XMLDOM")
end sub
public function openxml(thefile)
thexmldom.async=false
thexmldom.load thefile
end function
public function itemlen(tag)
set itemthing=thexmldom.getElementsByTagName(tag)
itemlen=itemthing.length
end function
public function additemblogm(blogtitle,blogcontent,thelink,thefile)
set addroot=thexmldom.createElement("blog")
set root=thexmldom.documentElement
set currnode = root.insertBefore(addroot, root.childNodes(0))
currnode.setAttribute "date",date
currnode.setAttribute "time",time
set blogtitleadd=thexmldom.createElement("blogtitle")
set blogtitled=currnode.appendchild(blogtitleadd)
blogtitled.text=blogtitle
set blogcontentadd=thexmldom.createElement("blogcontent")
set blogcontentd=currnode.appendchild(blogcontentadd)
blogcontentd.text=blogcontent
set bloglinkadd=thexmldom.createElement("link")
set bloglinkd=currnode.appendchild(bloglinkadd)
bloglinkd.text=thelink
set blogcommentadd=thexmldom.createElement("comment")
currnode.appendchild blogcommentadd
thexmldom.save thefile
end function
public function addrecentxml(blogtitle,blogcontent,thelink,thefile,blogshownum)
set root=thexmldom.documentElement
set addroot=thexmldom.createElement("blog")
if root.childNodes.length=0 then
set currnode=root.appendchild(addroot)
else
set currnode = root.insertBefore(addroot, root.childNodes(0))
end if
if root.childNodes.length=blogshownum then
root.removeChild root.lastchild
end if
currnode.setAttribute "date",date
currnode.setAttribute "time",time
set blogtitleadd=thexmldom.createElement("blogtitle")
set blogtitled=currnode.appendchild(blogtitleadd)
blogtitled.text=blogtitle
set blogcontentadd=thexmldom.createElement("blogcontent")
set blogcontentd=currnode.appendchild(blogcontentadd)
blogcontentd.text=blogcontent
set bloglinkadd=thexmldom.createElement("link")
set bloglinkd=currnode.appendchild(bloglinkadd)
bloglinkd.text=thelink
set blogcommentadd=thexmldom.createElement("comment")
currnode.appendchild blogcommentadd
thexmldom.save thefile
end function
function showblogxml()
set blogroot=thexmldom.getElementsByTagName("blog")
bloglen=blogroot.length
for i=0 to bloglen-1
if i=0 then
str="<table><tr><td>"
thedate= blogroot.item(i).getAttribute("date")
str=str & thedate & "</td></tr>"
else
thedate1=blogroot.item(i).getAttribute("date")
if thedate<>thedate1 then
thedate=thedate1
str=str & thedate & "</td></tr>"
end if
end if
str=str & "<tr><td>" & blogroot.item(i).childNodes(0).text & "<br />" & blogroot.item(i).childNodes(1).text & "</td></tr>"
str=str & "<tr><td><a href='" & blogroot.item(i).childNodes(2).text & "'>链接地址</a></td></tr>"
next
if bloglen<>0 then
str=str & "</table>"
end if
showblogxml=str
end function
function ebloginfo(blogtitle,thelink)
set blogroot=thexmldom.getElementsByTagName("blogall")
set currnode=thexmldom.createElement("blog")
bloglen=blogroot.childNodes.length
if bloglen=0 then
set blogcur=blogroot.appendchild(currnode)
else
set blogcur=blogroot.insertBefore(currnode, blogroot.firstchild)
end if
blogcur.setAttribute "link",thelink
blogcur.setAttribute "title",blogtitle
blogcur.setAttribute "date",date
blogcur.setAttribute "time",time
end function
Private Sub Class_Terminate
set thexmldom=nothing
End Sub
end class
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<base target="_self" />
<script language="vbscript" src="blogxmldom.vbs"></script>
<script language="vbscript" src="calendar.vbs"></script>
<script language="vbscript" src="xmldom.vbs"></script>
<script language="vbscript" src="fsooperation.vbs"></script>
<script language="vbscript" src="main.vbs"></script>
<style>
.calendarcss{font-family:"Arial";
font-size:12px;
color:#000000;
}
</style>
</head>
<body οnlοad="init()">
<span id="blogname"></span>
<table id="calendartable" class="calendarcss">
<tr>
<td>S</td><td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td>
</tr>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
</table>
<xsl:apply-templates select="blogrecent" />
</body>
</html>
</xsl:template>
<xsl:template match="blogrecent">
<xsl:for-each select="blog">
<div>
<xsl:value-of select="@time" />
title:
<xsl:value-of select="blogname" />
<a href="http://www.google.com">google</a>
</div>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
public tempelatefile,tmpdata
sub ofile()'打开文件,并把文件内容放到tmpdata
on error resume next
tmpdata=""
set Astream=Server.CreateObject ("Adodb.Stream")
Astream.type=2'文件类型文本
Astream.Mode = 3'读写
Astream.open
Astream.CharSet = "GB2312"'字符集
Astream.LoadFromFile(tempelatefile)'从文件装载
Assp=Astream.size
if err.number<>0 then
xz=-18
response.Write tempelatefile&"<br>"
err.clear
tmpdata=""
else
tmpdata=Astream.ReadText(Assp)
end if
end sub
sub save_file()
ofile()
recfilen=server.MapPath(dts)
Astream.Flush
Astream.close
Astream.type=2
Astream.Mode = 3
Astream.open
Astream.CharSet = "GB2312"
Astream.position=0
Astream.Writetext tmpdata,1'写入数据到stream
Astream.SaveToFile recfilen,2'保存到文件
end sub
function dts()'产生随机文件名
if len(month(now()))>1 then
mm=month(now())
else
mm="0"&month(now())
end if
if len(day(now()))>1 then
d=day(now())
else
d="0"&day(now())
end if
if len(hour(now()))>1 then
h=hour(now())
else
h="0"&hour(now())
end if
if len(minute(now()))>1 then
m=minute(now())
else
m="0"&minute(now())
end if
if len(second(now()))>1 then
s=second(now())
else
s="0"&second(now())
end if
Randomize
upperbound=9999
lowerbound=1000
rds=Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
dts="htm/"&year(now())&mm&d&h&m&s&rds&".htm"
end function
title=request.Form("title")
content=request.Form("content")
tmpdata=replace(tmpdata,"<title></title>",title)'以拥护提交内容替换
tmpdata=replace(tmpdata,"<content></content>",content)
tempelatefile=server.MapPath("tempelate/1.htm")'模版文件
save_file()
%>