This kind of code is mostly used when we have not implemented the function of designing to generate static, but we want to temporarily generate some dynamic pages into static ones. We can directly obtain the dynamic content and save it as static.
Copy the code code as follows:
<!--#include file="admin_Checkuser.asp"-->
<%
call ConnectionDatabase()
dim str,str_new
str=""
str_new=""
sqlx="select id from Fl_Products order by id desc"
set rsx=conn.execute(sqlx)
do while not rsx.eof
str=str&rsx("id")&"|"
rsx.movenext :loop
rsx.close
sqlx="select id from Fl_News order by id desc"
set rsx=conn.execute(sqlx)
do while not rsx.eof
str_new=str_new&rsx("id")&"|"
rsx.movenext :loop
rsx.close
place=InStrRev(str,"|")
str=Left(str,place-1)
place=InStrRev(str_new,"|")
str_new=Left(str_new,place-1)
dim url,cwww,act
act=Trim(Request.QueryString("act"))
url =Request.ServerVariables("HTTP_HOST")
cwww="http://"+url
MakeHtm cwww&"/index.asp","../index.htm","Home page written successfully!"
MakeHtm cwww&"/about.asp","../about.htm","Company profile written successfully!"
MakeHtm cwww&"/contact.asp","../contact.htm","Contact us written successfully!"
MakeHtm cwww&"/ry.asp","../ry.htm","Qualifications and honors written successfully!"
MakeHtm cwww&"/liuyan.asp","../liuyan.htm","Contact us and write successfully!"
MakeHtm cwww&"/pro.asp","../pro.htm","Product display written successfully!"
MakeHtm cwww&"/news.asp","../news.htm","Generate workshop writing successfully!"
MakeHtm cwww&"/xinwen.asp","../xinwen.htm","News information written successfully!"
MakeHtm cwww&"/alliance.asp","../alliance.htm","Sales network written successfully!"
'Generate product
xstr=split(str,"|")
for i=0 to ubound(xstr)
MakeHtm cwww&"/uzProduct.asp?id="&xstr(i),"../uzProduct_"&xstr(i)&".htm","Product"&xstr(i)&"Written successfully!"
next
xstr=split(str_new,"|")
for i=1 to ubound(xstr)/25+1
MakeHtm cwww&"/xinwen.asp?Page="&i,"../xinwen_"&i&".htm","News List"&i&"Written successfully!"
next
xstr=split(str_new,"|")
for i=0 to ubound(xstr)
MakeHtm cwww&"/uzNews.asp?id="&xstr(i),"../uzNews_"&xstr(i)&".htm","News"&xstr(i)&"Write successfully!"
next
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
Function MakeHtm(curl,turl,mess)
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
'Replace the following address with the file address of your homepage. Be sure to use the absolute path at the beginning. You cannot write a relative path.
xml.Open "GET", curl, False
xml.Send
BodyText=xml.ResponseBody
BodyText=BytesToBstr(BodyText,"gb2312")
Set xml = Nothing
'replace
BodyText=RegReplace(BodyText,"uzProduct/.asp/?id=(/d*)", "uzProduct_$1.htm")
BodyText=RegReplace(BodyText,"uzNews/.asp/?id=(/d*)", "uzNews_$1.htm")
BodyText=RegReplace(BodyText,"xinwen/.asp/?Page=(/d*)", "xinwen_$1.htm")
BodyText=replace(BodyText,"index.asp","index.htm")
BodyText=replace(BodyText,"about.asp","about.htm")
BodyText=replace(BodyText,"pro.asp","pro.htm")
BodyText=replace(BodyText,"news.asp","news.htm")
BodyText=replace(BodyText,"liuyan.asp","liuyan.htm")
BodyText=replace(BodyText,"ry.asp","ry.htm")
BodyText=replace(BodyText,"xinwen.asp","xinwen.htm")
BodyText=replace(BodyText,"contact.asp","contact.htm")
Dim fso, MyFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile= fso.CreateTextFile(server.MapPath(turl), True)
MyFile.WriteLine(BodyText)
MyFile.Close
response.Write mess
response.Write "<br>"
End Function
Public Function RegReplace(sContent, sPatrn, sNewStr)
Dim oTempReg : Set oTempReg = New RegExp
With oTempReg
.IgnoreCase = True
.Global=True
.Pattern = sPatrn
RegReplace = .Replace(sContent, sNewStr)
End With
Set oTempReg = Nothing
End Function
call CloseDatabase()
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Untitled Document</title>
<style>
body,td{font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:10.5pt;}
</style>
</head>
<body>
</body>
</html>
from iisboy