ASP generated static HTML (dynamic Read) _ Application Techniques

Source: Internet
Author: User
Copy 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 as not rsx.eof
STR=STR&AMP;RSX ("id") & "|"
Rsx.movenext:loop
Rsx.close
sqlx= "SELECT ID from fl_news ORDER by id DESC"
Set Rsx=conn.execute (SQLX)
Do as not rsx.eof
STR_NEW=STR_NEW&AMP;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 write success! "
makehtm cwww& "/about.asp", ". /about.htm "," Enterprise Profile write Success! "
makehtm cwww& "/contact.asp", ". /contact.htm "," Contact us to write success! "
makehtm cwww& "/ry.asp", ". /ry.htm "," Qualification honors write success! "
makehtm cwww& "/liuyan.asp", ". /liuyan.htm "," Contact us to write success! "
makehtm cwww& "/pro.asp", ". /pro.htm "," Product presentation success! "
makehtm cwww& "/news.asp", ". /news.htm "," Build Workshop write Success! "
makehtm cwww& "/xinwen.asp", ". /xinwen.htm "," News information write success! "
makehtm cwww& "/alliance.asp", ". /alliance.htm "," Sales Network write Success! "
' Generate products
Xstr=split (str, "|")
For i=0 to UBound (XSTR)
makehtm cwww& "/uzproduct.asp?id=" &xstr (i), ". /uzproduct_ "&xstr (i) &". htm "," Product &xstr (i) & "write Success! "
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&" Write success! "
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 Success! " "
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 address of your home page, be sure to use the absolute path beginning with http://, cannot write 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 ()
%>
<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>
<body>
</body>


From Iisboy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.