<!--#include file="char.inc"--> <% '生成首页 function indexhtml() Html_Temp="<UL>" Html_Temp = Html_Temp&"<LI>" FileName = "index.htm" '生成文件夹 FilePath = Server.MapPath("../")&"/"&FileName&"" Html_Temp = Html_Temp&FilePath&"</LI>" Do_Url = "http://" Do_Url = Do_Url&Request.ServerVariables("SERVER_NAME")&"/"&sites&"asp/index.asp?tt="&now()&"" strUrl = Do_Url set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP") objXmlHttp.open "GET",strUrl,false,"","" objXmlHttp.send() binFileData = objXmlHttp.responseBody set objAdoStream = Server.CreateObject("ADODB.Stream") objAdoStream.Type = 1 objAdoStream.Open() objAdoStream.Write(binFileData) objAdoStream.SaveToFile FilePath,2 objAdoStream.Close() Html_Temp = Html_Temp&"<UL>" end function '留言生成 function messagehtml() set fso = createobject("scripting.filesystemobject") fso.deletefile(Server.MapPath("../")&"/message.html") set fso = nothing Html_Temp="<UL>" Html_Temp = Html_Temp&"<LI>" FileName = "message.html" FilePath = Server.MapPath("/")&"/"&FileName Html_Temp = Html_Temp&FilePath&"</LI>" Do_Url = "http://" Do_Url = Do_Url&Request.ServerVariables("SERVER_NAME")&"/message.asp?tt="&now()&"" strUrl = Do_Url set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP") objXmlHttp.open "GET",strUrl,false,"","" objXmlHttp.send() binFileData = objXmlHttp.responseBody set objAdoStream = Server.CreateObject("ADODB.Stream") objAdoStream.Type = 1 objAdoStream.Open() objAdoStream.Write(binFileData) objAdoStream.SaveToFile FilePath,2 objAdoStream.Close() Html_Temp = Html_Temp&"<UL>" end function '-------生成静态页面 '-------keys 为信息的总id '-------Site 为生成的文件夹名称 function addhtml(keys) Dim fso,tanglei,left_site,left_site1,leftxx,leftxxx,strOut Dim strtitle,strlid,strpic,strpic_xiao,strcontent,strshijian '创建文件系统对象 'Set fso=Server.CreateObject("Scripting.FileSystemObject") '打开网页模板文件,读取模板内容 'Set f=fso.OpenTextFile(Server.MapPath("../")&"/asp/show_"&keys&".htm") 'strOut=f.ReadAll 'f.close strOut=ReadFromUTF(Server.MapPath("../")&"/asp/show_"&keys&".htm","utf-8") '读取数据信息 set rs1=server.CreateObject("adodb.recordset") rs1.open "select site from "&table&" where id="&keys&" ",conn,3,3 left_site=rs1("site") rs1.close set rs1=nothing set rs1=server.CreateObject("adodb.recordset") rs1.open "select site from "&table&" where id=150 ",conn,3,3 left_site1=rs1("site") rs1.close set rs1=nothing leftxxx="" if instr(strOut,"{left_site1}")<>0 then set rs1=server.CreateObject("adodb.recordset") rs1.open "select id,hid from "&table&" where lid=150 ",conn,3,3 do while not rs1.eof leftxxx=leftxxx&left_site1 leftxxx=Replace(leftxxx,"{left_id}",rs1("id")) leftxxx=Replace(leftxxx,"{left_title}",rs1("hid")) rs1.movenext loop rs1.close set rs1=nothing strOut=Replace(strOut,"{left_site1}",leftxxx) end if '没有分类的左边显示 leftxx="" if shangjis(keys)=99 then set rs1=server.CreateObject("adodb.recordset") rs1.open "select id,title from "&tables&" where lid="&keys&" ",conn,3,3 do while not rs1.eof leftxx=leftxx&left_site leftxx=Replace(leftxx,"{left_id}",rs1("id")) leftxx=Replace(leftxx,"{left_title}",rs1("title")) rs1.movenext loop rs1.close set rs1=nothing else set rs1=server.CreateObject("adodb.recordset") rs1.open "select id,hid from "&table&" where lid="&keys&" ",conn,3,3 do while not rs1.eof leftxx=leftxx&left_site leftxx=Replace(leftxx,"{left_id}",rs1("id")) leftxx=Replace(leftxx,"{left_title}",rs1("hid")) rs1.movenext loop rs1.close set rs1=nothing end if set rs1=server.CreateObject("adodb.recordset") rs1.open "select top 1 * from "&tables&" order by shijian desc ",conn,3,3 strid=rs1("id") strtitle=rs1("title") strlid=fenleis(rs1("lid")) strpic=rs1("pic") strpic_xiao=rs1("pic_xiao") strcontent=rs1("content") strshijian=rs1("shijian") 'strhit_count=rs1("hit_count") 'strguanjianzi=rs1("guanjianzi") strwenben1=rs1("wenben1") strwenben2=rs1("wenben2") strwenben3=rs1("wenben3") strwenben4=rs1("wenben4") strwenben5=rs1("wenben5") strtext1=rs1("text1") strtext2=rs1("text2") strtext3=rs1("text3") strtext4=rs1("text4") strtext5=rs1("text5") rs1.close set rs1=nothing '用真实内容替换模板中的标记 if instr(strOut,"{wznames}")<>0 then strOut=Replace(strOut,"{wznames}",wznames) if instr(strOut,"{wzmiaoshu}")<>0 then strOut=Replace(strOut,"{wzmiaoshu}",wzmiaoshu) if instr(strOut,"{wzkeys}")<>0 then strOut=Replace(strOut,"{wzkeys}",wzkeys) if instr(strOut,"{title}")<>0 then strOut=Replace(strOut,"{title}",strtitle) if instr(strOut,"{wztop}")<>0 then strOut=Replace(strOut,"{wztop}",wztop) if instr(strOut,"{wzfoot}")<>0 then strOut=Replace(strOut,"{wzfoot}",wzfoot) if instr(strOut,"{left_site}")<>0 then strOut=Replace(strOut,"{left_site}",leftxx) if instr(strOut,"{lid}")<>0 then strOut=Replace(strOut,"{lid}",strlid) if instr(strOut,"{pic}")<>0 then strOut=Replace(strOut,"{pic}",strpic) if instr(strOut,"{pic_xiao}")<>0 then strOut=Replace(strOut,"{pic_xiao}",strpic) if instr(strOut,"{content}")<>0 then strOut=Replace(strOut,"{content}",strcontent) if instr(strOut,"{shijian}")<>0 then strOut=Replace(strOut,"{shijian}",strshijian) 'if instr(strOut,"{hit_count}")<>0 then strOut=Replace(strOut,"{hit_count}",strhit_count) 'if instr(strOut,"{guanjianzi}")<>0 then strOut=Replace(strOut,"{guanjianzi}",strguanjianzi) if instr(strOut,"{wenben1}")<>0 then strOut=Replace(strOut,"{wenben1}",strwenben1) if instr(strOut,"{wenben2}")<>0 then strOut=Replace(strOut,"{wenben2}",strwenben2) if instr(strOut,"{wenben3}")<>0 then strOut=Replace(strOut,"{wenben3}",strwenben3) if instr(strOut,"{wenben4}")<>0 then strOut=Replace(strOut,"{wenben4}",strwenben4) if instr(strOut,"{wenben5}")<>0 then strOut=Replace(strOut,"{wenben5}",strwenben5) if instr(strOut,"{text1}")<>0 then strOut=Replace(strOut,"{text1}",strtext1) if instr(strOut,"{text2}")<>0 then strOut=Replace(strOut,"{text2}",strtext2) if instr(strOut,"{text3}")<>0 then strOut=Replace(strOut,"{text3}",strtext3) if instr(strOut,"{text4}")<>0 then strOut=Replace(strOut,"{text4}",strtext4) if instr(strOut,"{text5}")<>0 then strOut=Replace(strOut,"{text5}",strtext5) '创建要生成的静态页 Filen=Server.MapPath("../html/"&strid&".htm") '生成静态页文件存放位置 Call WriteToUTF(strOut,Filen) '生成静态页 end function '-------修改静态页面 function edithtml(keys,id) '创建文件系统对象 'Set fso=Server.CreateObject("Scripting.FileSystemObject") '打开网页模板文件,读取模板内容 'Set f=fso.OpenTextFile(Server.MapPath("../")&"/asp/show_"&keys&".htm") 'strOut=f.ReadAll ' f.close strOut=ReadFromUTF(Server.MapPath("../")&"/asp/show_"&keys&".htm","utf-8") '读取数据信息 set rs1=server.CreateObject("adodb.recordset") rs1.open "select site from "&table&" where id="&keys&" ",conn,3,3 left_site=rs1("site") rs1.close set rs1=nothing set rs1=server.CreateObject("adodb.recordset") rs1.open "select site from "&table&" where id=150 ",conn,3,3 left_site1=rs1("site") rs1.close set rs1=nothing leftxxx="" if instr(strOut,"{left_site1}")<>0 then set rs1=server.CreateObject("adodb.recordset") rs1.open "select id,hid from "&table&" where lid=150 ",conn,3,3 do while not rs1.eof leftxxx=leftxxx&left_site1 leftxxx=Replace(leftxxx,"{left_id}",rs1("id")) leftxxx=Replace(leftxxx,"{left_title}",rs1("hid")) rs1.movenext loop rs1.close set rs1=nothing strOut=Replace(strOut,"{left_site1}",leftxxx) end if '没有分类的左边显示 leftxx="" if shangjis(keys)=99 then set rs1=server.CreateObject("adodb.recordset") rs1.open "select id,title from "&tables&" where lid="&keys&" ",conn,3,3 do while not rs1.eof leftxx=leftxx&left_site leftxx=Replace(leftxx,"{left_id}",rs1("id")) leftxx=Replace(leftxx,"{left_title}",rs1("title")) rs1.movenext loop rs1.close set rs1=nothing else set rs1=server.CreateObject("adodb.recordset") rs1.open "select id,hid from "&table&" where lid="&keys&" ",conn,3,3 do while not rs1.eof leftxx=leftxx&left_site leftxx=Replace(leftxx,"{left_id}",rs1("id")) leftxx=Replace(leftxx,"{left_title}",rs1("hid")) rs1.movenext loop rs1.close set rs1=nothing end if set rs1=server.CreateObject("adodb.recordset") rs1.open "select * from "&tables&" where id="&id&" ",conn,3,3 strid=rs1("id") strtitle=rs1("title") strlid=fenleis(rs1("lid")) strpic=rs1("pic") strpic_xiao=rs1("pic_xiao") strcontent=rs1("content") strshijian=rs1("shijian") 'strhit_count=rs1("hit_count") 'strguanjianzi=rs1("guanjianzi") strwenben1=rs1("wenben1") strwenben2=rs1("wenben2") strwenben3=rs1("wenben3") strwenben4=rs1("wenben4") strwenben5=rs1("wenben5") strtext1=rs1("text1") strtext2=rs1("text2") strtext3=rs1("text3") strtext4=rs1("text4") strtext5=rs1("text5") rs1.close set rs1=nothing '用真实内容替换模板中的标记 if instr(strOut,"{wznames}")<>0 then strOut=Replace(strOut,"{wznames}",wznames) if instr(strOut,"{wzmiaoshu}")<>0 then strOut=Replace(strOut,"{wzmiaoshu}",wzmiaoshu) if instr(strOut,"{wzkeys}")<>0 then strOut=Replace(strOut,"{wzkeys}",wzkeys) if instr(strOut,"{title}")<>0 then strOut=Replace(strOut,"{title}",strtitle) if instr(strOut,"{wztop}")<>0 then strOut=Replace(strOut,"{wztop}",wztop) if instr(strOut,"{wzfoot}")<>0 then strOut=Replace(strOut,"{wzfoot}",wzfoot) if instr(strOut,"{left_site}")<>0 then strOut=Replace(strOut,"{left_site}",leftxx) if instr(strOut,"{lid}")<>0 then strOut=Replace(strOut,"{lid}",strlid) if instr(strOut,"{pic}")<>0 then strOut=Replace(strOut,"{pic}",strpic) if instr(strOut,"{pic_xiao}")<>0 then strOut=Replace(strOut,"{pic_xiao}",strpic) if instr(strOut,"{content}")<>0 then strOut=Replace(strOut,"{content}",strcontent) if instr(strOut,"{shijian}")<>0 then strOut=Replace(strOut,"{shijian}",strshijian) 'if instr(strOut,"{hit_count}")<>0 then strOut=Replace(strOut,"{hit_count}",strhit_count) 'if instr(strOut,"{guanjianzi}")<>0 then strOut=Replace(strOut,"{guanjianzi}",strguanjianzi) if instr(strOut,"{wenben1}")<>0 then strOut=Replace(strOut,"{wenben1}",strwenben1) if instr(strOut,"{wenben2}")<>0 then strOut=Replace(strOut,"{wenben2}",strwenben2) if instr(strOut,"{wenben3}")<>0 then strOut=Replace(strOut,"{wenben3}",strwenben3) if instr(strOut,"{wenben4}")<>0 then strOut=Replace(strOut,"{wenben4}",strwenben4) if instr(strOut,"{wenben5}")<>0 then strOut=Replace(strOut,"{wenben5}",strwenben5) if instr(strOut,"{text1}")<>0 then strOut=Replace(strOut,"{text1}",strtext1) if instr(strOut,"{text2}")<>0 then strOut=Replace(strOut,"{text2}",strtext2) if instr(strOut,"{text3}")<>0 then strOut=Replace(strOut,"{text3}",strtext3) if instr(strOut,"{text4}")<>0 then strOut=Replace(strOut,"{text4}",strtext4) if instr(strOut,"{text5}")<>0 then strOut=Replace(strOut,"{text5}",strtext5) '创建要生成的静态页 ' Set fso = CreateObject("Scripting.FileSystemObject") ' Set f=fso.CreateTextFile(Server.MapPath("../html/"&strid&".htm"),True,True) ' ' '写入网页内容 ' f.WriteLine strOut ' f.close ' set f=nothing ' '写入网页内容 ' set fso=Nothing Filen=Server.MapPath("../html/"&strid&".htm") '生成静态页文件存放位置 Call WriteToUTF(strOut,Filen) '生成静态页 end function %> <% Function ReadFromUTF(TempString,CharSet) 'TempString为要读取的模版文件路径;Charset是编码 Dim str Set stm=server.CreateObject("adodb.stream") stm.Type=2 stm.Mode=3 stm.Charset=CharSet stm.Open stm.loadfromfile TempString str=stm.readtext stm.Close Set stm=Nothing ReadFromUTF=str End Function Function WriteToUTF(content,Filen) '将替换后的内容写入HTML文档,content为替换后的字符串,Filen为生成的文件名 Set objStream=Server.CreateObject("ADODB.Stream") With objStream .Open .Charset="utf-8" '编码,这里你可以改成任何编码 .Position=objStream.Size .WriteText=content '模版+数据 写入内容 .SaveToFile Filen,2 '生成文件路径 .Close End With Set objStream=Nothing End Function %> <% function SafeRequest(ParaName,ParaType) '数字1 '字符0 dim ParaValue ParaValue=request(ParaName) if ParaType=1 then if not isnumeric(ParaValue) then response.End() else ParaValue=replace(ParaValue,"'","''") end if SafeRequest=ParaValue end function function chkStr(s_string) s_string=replace(s_string,"&","&") 's_string=replace(s_string," "," ") s_string=replace(s_string,"<","<") 'chkStr=replace(s_string,">",">") chkStr=htmlencode(s_string) end function function form_db(str) form_db=replace(str," "," ") form_db=replace(form_db,chr(13),"<br>") form_db=htmlencode(str) end function function db_form(str) db_form=replace(str," "," ") db_form=replace(db_form,"<br>",chr(13)) 'db_form=db_form(unhtml) end function %> <% '分类函数递归显示 dim ids,n,i n=0 i=1 dim list(1000000) function lids(lid) dim sqls,rs Set rslid = Server.CreateObject("ADODB.Recordset") sqls="SELECT * FROM "&table&" WHERE lid="&Cint(lid)&" order by pid asc" n=n+1 rslid.open sqls,Conn,1,1 Do While Not rslid.Eof ids=""&ids&","&rslid(0)&"" list(i)=n i=i+1 Call lids(rslid(0)) rslid.Movenext Loop n=n-1 rslid.close End function function ins(num) str="" for ii=1 to num str=str&"|-" next ins=str end function %> <% '显示分类名字的函数 function fenleis(nums) set fenlei=server.CreateObject("adodb.recordset") sql="Select * from "&table&" where id="&nums&"" fenlei.open sql,conn,1,1 str=fenlei("hid") fenlei.close fenleis=str end function %> <% '显示上级分类名字的函数 function shangjis(nums) set shangji=server.CreateObject("adodb.recordset") sql="Select * from "&table&" where id="&nums&"" shangji.open sql,conn,1,1 str=shangji("lid") shangji.close shangjis=str end function %> <% '再来一段超级函数库,后台添加的内容 function yangshi(zhi,num,ziduanming,edit) if num=1 then %> <tr> <td ><div align="center"><%=zhi%></div></td> <td><input name="<%=ziduanming%>" type="text" class="border2" id="title" size="60" value="<%=edit%>"></td> </tr> <% elseif num=5 then %> <tr> <td><div align="center"><%=zhi%></div></td> <td><input name="<%=ziduanming%>" type="checkbox" value="<%=zhi%>" <%if edit<>"" then%> checked="checked" <%end if%>/> </td> </tr> <% elseif num=6 then %> <%if edit<>"" then%> <tr> <td><%=zhi%></td> <td><input name="<%=ziduanming%>" type="text" id="<%=ziduanming%>" value="<%=edit%>"/></td> </tr> <tr> <td></td> <td> <iframe id="1" src="upfile1.asp?path=big&name=<%=ziduanming%>" frameborder="0" scrolling="No" width="300" height="25"></iframe></td> </tr> <%else%> <tr> <td><%=zhi%></td> <td><input name="<%=ziduanming%>" type="text" id="<%=ziduanming%>" /></td> </tr> <tr> <td></td> <td> <iframe id="1" src="upfile1.asp?path=big&name=<%=ziduanming%>" frameborder="0" scrolling="No" width="300" height="25"></iframe></td> </tr> <%end if%> <% elseif num=7 then %> <mce:script language src="setday.js" mce_src="setday.js"></mce:script> <%if edit<>"" then%> <tr> <td><div align="center"><%=zhi%></div></td> <td><input name="<%=ziduanming%>" type="text" id="yqthsj" size="12" maxlength="12" onFocus="setday(this)" value="<%=edit%>"> </td> </tr> <%else%> <tr> <td><div align="center"><%=zhi%></div></td> <td><input name="<%=ziduanming%>" type="text" id="yqthsj" size="12" maxlength="12" onFocus="setday(this)" value="<%=datevalue(now())%>"> </td> </tr> <%end if %> <% elseif num=2 then %> <tr> <td ><div align="center"><%=zhi%></div></td> <td><textarea name="<%=ziduanming%>" cols="70" rows="10" class="border2" id="title" ><%=edit%>