- <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> 1 S- |% | ]: Y
- <%
5 }+ J+ [6 b( i$ _ - Function AllPath() 0 n( b: H; x5 k5 R! j
- Dim Domain,GFilePath ( \# C* e5 l0 Q8 O) e3 {8 m
- Domain = Request.ServerVariables("SERVER_NAME") & k) Z1 W: y' l5 |$ k
- GFilePath = Request.ServerVariables("PATH_INFO")
/ N# {, x" D3 H% o k! g4 j - GFilePath = lcase(left(GFilePath,instrRev(GFilePath,"/"))) ' h* Z0 @# m" m8 e
- AllPath = "http://www.w16888.com/" //唯一需要修改的地方,你的圖片目錄如果是在http://xxxx/myfile/angie/pic,這裡就寫http://xxx.com/myfile/angie/ ; # [5 s' ]- c2 W
- End Function ; p# w4 c7 `! b7 ~1 v+ F
- Function ShowFileList(folderspec) + u& T6 q* ] _9 b3 z5 [7 Y
- Dim Path,objFSO,objFolder,count,objFile,nume,S
. Z# a4 y+ d7 d( E - Path = Server.MapPath(folderspec)
( r6 h9 t5 G7 E - Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
& m+ B+ g$ c s. G. j - If objFSO.FolderExists(Path) Then : F: y! P0 i) K" [3 J
- Set objFolder = objFSO.GetFolder(Path)
0 Q6 Y/ |; @' W/ m7 r4 Q - count = 0 ! R9 S1 z) @ {! C" @
- For Each objFile in objFolder.Files
L& h" s/ c% a - count = count+1
E. [$ }/ c0 v! S0 _ - Next . e5 o$ E: x; I7 `1 k d w
- randomize
/ b1 c. C5 x: V5 C3 Y0 e - nume = Int((count*rnd)+1)
3 h* O) Y. M9 o9 |' X# O! h2 e5 y - S = 0 ( Q- }0 u! d/ o! M& y* @1 Y
- ShowFileList = "" 3 r+ x& ? V# i
- For Each objFile in objFolder.Files
7 U$ d3 w" D l - S = S + 1 : Y; S8 t* ]6 G9 }
- If S = nume Then 7 q/ k$ P$ W- N% }. h. h$ z
- ShowFileList = objFile.Name - V; f/ {, b; m# v. a3 S m
- Exit For
. E% h- s. r0 s2 l( q. P/ Q: h3 M7 S - End If
" t: p) \( } l; P" u8 P - Next
0 I( t! o: R5 ^; s# x - Set objFolder = Nothing / ^. } m; ~, s; H3 k% x9 X
- Else
x: @3 A" N3 r4 C3 Q0 c$ b - ShowFileList = "NO"
# v9 T4 ]( [+ k- p ? - End If
2 x. J( _! [ J$ T* n1 J9 ~4 J - Set objFSO = Nothing & G$ q3 X& S* K( ~/ q
- End Function
% a v4 @+ B: y$ r* t - Dim list,filename,address,str
9 ^6 Y& O+ g; _ - list = trim(Request.QueryString("list")) 0 G: l0 c! m% ]! }- L, D
- if list = "" then
" ?$ G2 c Y1 ^+ J - Response.write "本頁需要正確參數引入,您缺少相關的參數!正確格式如下:"&AllPath&"xxxxxx.asp?list=xxxxxx.jpg" ' j) f' Y2 z3 B$ Y! W T
- Response.End()
. f, K+ ~, l1 A! y6 G - end if 3 {' n% J" v; k& O* q7 @1 J. o
- filename = ShowFileList("./"&list&"/") $ I1 b$ z& V$ n3 l2 g8 Q; N7 i
- if filename = "NO" then
& ]4 X1 G! A2 k. s - Response.write "您指定的目錄<b>"&list&"</b>不存在,請重新指定!" , z4 X! P" m# n5 R
- Response.End()
' E4 p k! b2 i% z, K8 K - end if
: B. h8 L+ Z" [9 X - if filename = "" then * c4 T, m# W* g) i) r3 e3 }
- Response.write "您指定的目錄<b>"&list&"</b>沒有相關的圖片文件存在,請重新指定!" 9 ^8 `$ {0 k7 P: m
- Response.End() 2 S5 F9 S, h9 y; A {7 k
- end if
' n& U- C( M Z4 G) Q& W) O: K - str = right(filename,3) : C$ g3 U# |2 V8 X3 K2 x! @1 o
- if str<>"jpg" and str<>"gif" then 7 B( I8 y3 q- M" O5 h& J* g6 ~
- filename = "erro.gif"
2 E! [# F5 d2 X; E - end if * J9 Q( Q5 T- j
- address = AllPath&list&"/"
, g+ ]6 P0 y/ }. N+ O2 y5 W - address = address&filename ( `. T, S e- J# \6 p8 H# U
- %>
+ @3 M8 m) f, \+ y l6 L - <%Response.redirect(address)%>
0 Q* G! _' j. `, w' P( e - 把這段代碼保存為im.asp' b, p G' A# S. p( w# w r: u
- 把美女圖片放在pic文件夾下,把pic文件夾和im.asp放在網站根目錄下,在瀏覽器裡打開演
複製代碼 0 M m$ ~2 P+ k$ E% ?* L9 n# ?% L
[ 本帖最後由 tcbxh2008 於 2007-6-3 16:47 編輯 ] |
|