阿七
老婆不在家
级别: 总版主
精华:
11
发帖: 8334
威望: 93 点
金钱: 8054 RMB
贡献值: 220 点
在线时间:2286(小时)
注册时间:2003-10-08
最后登录:2008-09-18
|
ASP百变图代码 [实用收藏]
asp源码 !>@V#I _r5Ild@n ************************* 随机图片显示 **************************** WI!z92qq[ '使用实例:img.asp?list=图片存放目录 H.[&gm}p> '使用注意:图片目录放于本文件同目录下!需要FSO支持! p33GKg0i+( '说明:只要将变化图片放于一个目录下,修改下面程序的(需要修改的地方)成你的目录名称!
+sl uu!~ 上传本程序和图片文件夹到同一目录下,在发帖时候使用UBB代码形如:即可!
![!b^:f '---------------------------------------------------------------------------------------- &2]D+aL|h Function AllPath() KdpJ[[Ug/ Dim Domain,GFilePath
q8bS@\i Domain = Request.ServerVariables("SERVER_NAME") d>98 E9
GFilePath = Request.ServerVariables("PATH_INFO") Xgc\O08 GFilePath = lcase(left(GFilePath,instrRev(GFilePath,"/"))) "wC5hj] AllPath = "http://"&Domain&GFilePath TXl9c6 End Function i4r~eneP DmPsltpzQ Function ShowFileList(folderspec) _-\{kJ Dim Path,objFSO,objFolder,count,objFile,nume,S h1o+7 Path = Server.MapPath(folderspec) XRz6Yf(/ Set objFSO = Server.CreateObject("Scripting.FileSystemObject") %9Fg1LH42r If objFSO.FolderExists(Path) Then 6lAo`S\)eX Set objFolder = objFSO.GetFolder(Path) 1H
6Wrik count = 0 \^LR5S& For Each objFile in objFolder.Files OSIp count = count+1 N|vJrye Next c6)zx
b randomize {[~,q\M[ nume = Int((count*rnd)+1) &L~rq)r/& S = 0 C$gLi8|m ShowFileList = "" [KJL%u|8/ For Each objFile in objFolder.Files ;rL$z;}8 S = S + 1 F[Sat;Sll If S = nume Then oU? X"B9 ShowFileList = objFile.Name n_meJm. Exit For
K_3ZJ End If ?
%ntO] Next cA2]VL.r>C Set objFolder = Nothing .r'.5RI A Else 9`&D ShowFileList = "NO" oX,M;;Yq End If gHshG;z* Set objFSO = Nothing miSC'! End Function )wd~639U .X1niguXH Dim list,2004528115924.htm,address,str 0in6z (p!AX<=z list = trim(Request.QueryString("list")) kw'D2692 if list = "" then v^G5
N)F Response.write "本页需要正确参数引入,您缺少相关的参数!正确格式如下:"&AllPath&"img.asp?list=(需要修改的地方)" t+ ]+Gn Response.End() m(Ynl=c
end if my6T@0R etVE8N' 2004528115924.htm = ShowFileList("./"&list&"/") >0oc=9H8 if 2004528115924.htm = "NO" then ><
qE5D[ Response.write "您指定的目录<b>"&list&"</b>不存在,请重新指定!" vcHDFi Response.End() [f}1wZ* end if .O^|MhBJu HZ3<}`P_W if 2004528115924.htm = "" then w5Xdq_e3 Response.write "您指定的目录<b>"&list&"</b>没有相关的图片文件存在,请重新指定!" 4r*6fJ*bJ Response.End() m/AN*`V end if VrK 5a9*^ VbYapPu4b! str = right(2004528115924.htm,3) X(\RA.64 if str<>"jpg" and str<>"gif" then q8J/tw?%v 2004528115924.htm = "erro.gif" `UR.Rn/x end if D[mYrWHpn |Th{*IJ<, address = AllPath&list&"/" a4yU[KK address = address&2004528115924.htm .\ZxwD| %> z$NLFJvy_- <%Response.redirect(address)%>
|
|
|
|
[楼 主]
|
Posted: 2006-05-04 10:42 |
| |