过期域名预定抢注

 找回密碼
 免费注册

Web 在線代理的 ASP 版!(開源)

[複製鏈接]
發表於 2007-4-16 10:39:50 | 顯示全部樓層 |閱讀模式
  1. <%@LANGUAGE="JavaSCRIPT" CODEPAGE="65001"%> % g9 Y8 f' E( e6 V+ a/ S
  2. <%Response.Charset = "utf-8"%>   K; y3 s1 t/ }3 n# G( U; J
  3. <% 2 q5 O; V5 z! N* c  }" K% V
  4. Server.ScriptTimeout=9999999; + F* T/ q4 p: ^& A( r6 o
  5. var Surl = String(Request.QueryString("url")); ! {8 S1 E" o1 m6 ^  f4 U; T! Z
  6. if(Surl == "undefined"){
    8 ^" u4 S1 n% w: R7 P8 B% D6 K
  7. Response.Write("<p style="font-size:9pt;margin:30px;padding:10px;text-align:center;background-color:#FFCCCC;border: 1px solid #999999;">金光論壇 ASP WEB 在線代理程序 1.0 版</p>");
    $ S3 R- L' w. }3 g" ?
  8. Response.Write("<div style="font-size:9pt;margin:30px;text-align:center;background-color:#FFFFCC;border: 1px solid #999999;">"); , m$ V7 Z( j: |! J% u
  9. Response.Write("<form action="#" method="get" >");
    8 j7 ?8 F. T/ i  l  u3 A( k
  10. Response.Write("<p style="font-size:9pt;margin:5px;text-align:center;">請鍵入網址</p>");
    / a/ A& U4 c" l& i7 I2 o2 m
  11. Response.Write("<p><input style="background-color: #FFCCCC;border: 1px solid #999999;" type="text" name="url"></p>"); 6 e: r" R- ~' u3 W. I
  12. Response.Write("<p><input style="background-color: #FFCCCC;border: 1px solid #999999;" type="submit"  value="GoWeb"></p>");   D  @" j- `  s" I. S" F; h
  13. Response.Write("</div>"); ) p- J  c/ Z7 r2 g; c
  14. } 8 h% `6 S7 m! |$ K0 s& b* |$ ?
  15. else if(Surl == ""){ # v7 X$ L1 b* o, J8 a
  16. Response.Write("<p style="font-size:9pt;margin:30px;padding:10px;text-align:center;background-color:#FFCCCC;border: 1px solid #999999;">金光論壇 ASP WEB 在線代理程序 1.0 版</p>"); - @) G5 [( }! X4 L, w9 P
  17. Response.Write("<div style="font-size:9pt;margin:30px;text-align:center;background-color:#FFFFCC;border: 1px solid #999999;">"); % c  W: _& m  p% h: U$ _
  18. Response.Write("<p>您需要鍵入一個網址!例如: bbs.jgwy.net </p>"); 8 E# T1 j% U; i
  19. Response.Write("</div>");
      I# J! J7 b0 I2 @
  20. }
    - d  x4 o, R" @% E
  21. else{
    ! H/ s7 P; S+ d
  22. Surl = (Surl.substr(0,7) != "http://") ? "http://"+Surl : Surl; - ]( q. X" ^- {1 o
  23. Response.Write(send_request(Surl)); 5 [; c" \) y; n
  24. } 0 d$ U! \" Q. n& Z- F( S# h
  25. function send_request(url) { 9 H! Q! `- ~& y; {7 S
  26.     var codedtext;
    , y: S0 C3 a# X! M0 E5 X+ I
  27.     http_request = Server.CreateObject("Microsoft.XmlHTTP"); 0 Q/ C6 ]" K0 J2 w" n
  28.     try{
    8 U3 l0 Q2 j& r$ n4 ?" E
  29.     http_request.Open("GET",url,false);
    # Z. k0 F3 g, x. u% U* d( A
  30.     http_request.Send(null); ' e7 t* g2 Q6 z9 j
  31.     }
    3 ~% m1 C' P3 I, P6 c
  32.     catch(e)
    2 e+ h/ X3 V& P& f
  33.     { . t1 q" Q$ C1 @, r: [" [% @
  34.     Response.Write(e.description); 0 {  E  j7 Q0 \6 t2 ^
  35.     }
    & _) a  C1 b8 v( n
  36.     if (http_request.ReadyState == 4){ ! C' ^% q" Q) G
  37.         //自動判斷編碼開始
    - J" X) z; F* C. S5 Z8 Y
  38.         var charresult = http_request.ResponseText.match(/CharSet=(\S+)"/i); . P) J, l( Z' w) l' x2 d3 \  G/ A$ S
  39.         if (charresult != null){
    / q  j" f/ p& y$ f1 n8 Q7 k
  40.         var Cset = charresult[1];
    : D7 j" R4 v# T; C0 c0 E6 g" c& x( Q
  41.         }else{Cset = "utf-8"}
    6 k) X  |3 P: X- `
  42.         //自動判斷編碼結束
    ' B) [3 u7 w/ ~3 C" b
  43.         codedtext = bytesToBSTR(http_request.Responsebody,Cset); ! T+ i! g% ?+ W. T  ~+ P
  44.         }else{ 5 A' V0 l9 w& z1 ~, J( i& k" S
  45.         codedtext = "Erro";
    0 h# z0 G  J7 K( q% @* l3 v# K" F2 G
  46.         }
    * p0 Y1 \8 S+ K) o/ u
  47.         //替換超連接 . y& J4 B3 t3 A, `, l. U
  48.         codedtext = codedtext.replace(/href="\/?/ig,"href=""+url+"/"); " r, J9 L0 d' k$ X6 J8 r
  49.         codedtext = codedtext.replace(/(<a.*href=")/ig,"$1index.asp?url=");
      R  B% P, \* S3 y0 a
  50.     return(codedtext);
    % k8 w9 I4 G' ]1 [
  51. }
    ( J4 i, g8 A8 b4 d! t+ s( V- ^9 Q# E
  52. function bytesToBSTR(body,Cset){
    0 k; i& x) ~3 X4 ]0 j
  53.     var objstream; 7 t' M# x* K( C; o0 P( g
  54.     objstream = Server.CreateObject("Adodb.Stream");
    1 R, |- e7 U* z; I. [! R. x
  55.     objstream.Type = 1; " e7 y! ^4 }; k- J# f7 X
  56.     objstream.Mode = 3; * {1 C3 `% [, J9 E* r. S
  57.     objstream.Open();
    1 b  h/ R3 s; F. O( T9 ^9 F. y" |
  58.     objstream.Write(body); . B% Z# \9 a2 Q( W3 F4 Q
  59.     objstream.Position = 0;
    3 ^4 H* R( p$ O4 t% \$ x' Q
  60.     objstream.Type = 2; * d" o/ V" J& |2 @6 _$ H5 }" O
  61.     objstream.Charset = Cset; & Z1 I* F- `  C) ~/ Q
  62.     bytesToBSTR = objstream.Readtext;
    7 P! @8 Q$ t3 {
  63.     objstream.Close; . H' h2 X( n! n  B7 Z
  64.     return(bytesToBSTR); " V9 q- G. j. c+ G! @
  65. } - r8 o2 h2 g' d. @
  66. function SaveRemoteFile(LocalFileName,RemoteFileUrl){
    / U4 S1 K0 M7 }* t8 [& m
  67.     var Retrieval,Ads;
    # W7 x/ Y' y$ U' _) l
  68.     Retrieval = Server.CreateObject("Microsoft.XmlHTTP");
    & q. m: A- G; o& B2 O6 U
  69.     Retrieval.Open("GET",RemoteFileUrl,false); ' p$ E( }% I8 i& B
  70.     Retrieval.Send(null); ; q0 G. h" S. K
  71.     if (Retrieval.ReadyState == 4){ % T, \9 G6 h  F3 H; }) j" B( ?5 b
  72.     Ads = Server.CreateObject("Adodb.Stream"); ) [/ w6 r5 f! J6 w) A5 h8 j
  73.     Ads.Type = 1;
    " ?; c" P, z$ z% I
  74.     Ads.Open();
    " G+ u% m- N: T
  75.     Ads.Write(Retrieval.Responsebody); 8 X1 c& ]& u# e5 W6 R1 a  Z
  76.     Ads.SaveToFile(Server.MapPath(LocalFileName),2);
    & m% [  e$ Z& ~5 m) g  m
  77.     Ads.Cancel; ) L4 d; y6 K: c
  78.     Ads.Close;
    / ~5 ~) O: F  t2 s; S
  79.     } 0 r9 t: N- l% L5 ~3 v
  80. }
    2 v$ ~4 }& A" O6 u. n0 b
  81. //SaveRemoteFile("aa.gif","/XrssFile/2007-1/12/2007112124640411.gif");
    % j, K  A& K1 I0 ~8 g+ c2 V& }
  82. %>
複製代碼
您需要登錄後才可以回帖 登錄 | 免费注册

本版積分規則

點基跨境 數位編輯創業論壇

GMT+8, 2025-7-15 04:16

By DZ X3.5

小黑屋

快速回復 返回頂部 返回列表