Key Technologies for generating static pages

Source: Internet
Author: User
Tags servervariables

<%
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 gethttppage (URL)
Dim HTTP
Set HTTP = server. Createobject ("msxml2.xmlhttp ")
HTTP. Open "get", URL, false
HTTP. Send ()
If HTTP. readystate <> 4 then
Exit Function
End if
Gethttppage = bytestobstr (HTTP. responsebody, "gb2312 ")
Set HTTP = nothing
If err. Number <> 0 then err. Clear
End Function


'/////////////////////////////////////// /////
Sub refresh_news (ID)

Set rs = server. Createobject ("ADODB. recordset ")
SQL = "select * From conews where id =" & ID &""
Rs. Open SQL, Conn, 1, 1
If Rs. EOF then
Response. Write "<script language = JavaScript> alert ('parameter error! ');"
Response. Write "window. Close (); </SCRIPT>"
Response. End
Else

Weburl = "http: //" & request. servervariables ("http_host ")

File_name = RS ("ID ")


Frompage = weburl & "/news_info.asp? Id = "& ID &""
Filename = "../news_detail/" & file_name & ". html"

Stext = gethttppage (frompage)

Set fileobject = server. Createobject ("scripting. FileSystemObject ")
Set openfile = fileobject. opentextfile (server. mappath (filename), 2, true)
Openfile. writeline (stext)
Set openfile = nothing

 
End if
Rs. Close
Set rs = nothing
End sub

Sub refresh_product (ID)

Set rs = server. Createobject ("ADODB. recordset ")
SQL = "select * from product where id =" & ID &""
Rs. Open SQL, Conn, 1, 1
If Rs. EOF then
Response. Write "<script language = JavaScript> alert ('parameter error! ');"
Response. Write "window. Close (); </SCRIPT>"
Response. End
Else

Weburl = "http: //" & request. servervariables ("http_host ")

File_name = RS ("ID ")


Frompage = weburl & "/product_info.asp? Id = "& request (" ID ")&""
Filename = "../product/" & file_name & ". html"

Stext = gethttppage (frompage)

Set fileobject = server. Createobject ("scripting. FileSystemObject ")
Set openfile = fileobject. opentextfile (server. mappath (filename), 2, true)
Openfile. writeline (stext)



Frompage = weburl & "/en/product_info.asp? Id = "& request (" ID ")&""
Filename = "../en/product/" & file_name & ". html"

Stext = gethttppage (frompage)

Set fileobject = server. Createobject ("scripting. FileSystemObject ")
Set openfile = fileobject. opentextfile (server. mappath (filename), 2, true)
Openfile. writeline (stext)
Set openfile = nothing

Set openfile = nothing
 

 
End if
Rs. Close
Set rs = nothing
End sub
Sub refresh_productlist2 (SID)

Set rs = server. Createobject ("ADODB. recordset ")
SQL = "select * From mm_product_smallclass where id =" & SID &""
Rs. Open SQL, Conn, 1, 1
If Rs. EOF then
Response. Write "<script language = JavaScript> alert ('parameter error! ');"
Response. Write "window. Close (); </SCRIPT>"
Response. End
Else

Weburl = "http: //" & request. servervariables ("http_host ")

File_name = RS ("ID ")


Frompage = weburl & "/product/index. asp? SID = "& RS (" ID ")&""
Filename = "../product/list2 _" & RS ("ID") & ". html"

Stext = gethttppage (frompage)

Set fileobject = server. Createobject ("scripting. FileSystemObject ")
Set openfile = fileobject. opentextfile (server. mappath (filename), 2, true)
Openfile. writeline (stext)
Set openfile = nothing
End if


Rs. Close
Set rs = nothing
End sub

Sub refresh_case (ID)

Set rs = server. Createobject ("ADODB. recordset ")
SQL = "select * from project where id =" & ID &""
Rs. Open SQL, Conn, 1, 1
If Rs. EOF then
Response. Write "<script language = JavaScript> alert ('parameter error! ');"
Response. Write "window. Close (); </SCRIPT>"
Response. End
Else

Weburl = "http: //" & request. servervariables ("http_host ")

File_name = RS ("ID ")


Frompage = weburl & "/case_info.asp? Id = "& request (" ID ")&""
Filename = "../case/" & file_name & ". html"

Stext = gethttppage (frompage)

Set fileobject = server. Createobject ("scripting. FileSystemObject ")
Set openfile = fileobject. opentextfile (server. mappath (filename), 2, true)
Openfile. writeline (stext)
Set openfile = nothing

 
End if
Rs. Close
Set rs = nothing
End sub
%>

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.