阿七
老婆不在家
级别: 总版主
精华:
11
发帖: 8334
威望: 93 点
金钱: 8054 RMB
贡献值: 220 点
在线时间:2286(小时)
注册时间:2003-10-08
最后登录:2008-09-18
|
ASP百变图代码 [实用收藏]
asp源码 d"~(T:=r =y%rG :! ************************* 随机图片显示 **************************** zzZg$9PT[ '使用实例:img.asp?list=图片存放目录 8
Op.eYe '使用注意:图片目录放于本文件同目录下!需要FSO支持! :Gh~fm3} '说明:只要将变化图片放于一个目录下,修改下面程序的(需要修改的地方)成你的目录名称! $
v}<'
上传本程序和图片文件夹到同一目录下,在发帖时候使用UBB代码形如:即可! Di=9mHC '---------------------------------------------------------------------------------------- .d
q
"k Function AllPath() xi'<y Dim Domain,GFilePath x:5dCI
Domain = Request.ServerVariables("SERVER_NAME")
FfM nul GFilePath = Request.ServerVariables("PATH_INFO") q42FPq GFilePath = lcase(left(GFilePath,instrRev(GFilePath,"/"))) }fIqH4bp AllPath = "http://"&Domain&GFilePath xRDi
Rj End Function FWPW/oC Q
e1oT) Function ShowFileList(folderspec) o;J;*~g Dim Path,objFSO,objFolder,count,objFile,nume,S -S; &Q'Mt Path = Server.MapPath(folderspec) Li`hdrO'ii Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 17py).\ If objFSO.FolderExists(Path) Then }.%s
xw Set objFolder = objFSO.GetFolder(Path) 2mJ:c count = 0 zS%
m_,t For Each objFile in objFolder.Files t*+! n.p count = count+1 z
Bf;fi Next e`DsP8-&v randomize pv$tTWk nume = Int((count*rnd)+1) U6i~A9; S = 0 sC6r.@[u8t ShowFileList = "" Ve:&'~F2 s For Each objFile in objFolder.Files a"qR J-@ S = S + 1 YeIe\3x!N If S = nume Then `!kL1oUYE ShowFileList = objFile.Name j7sU0"7^ Exit For ;qVG
\wQq End If ,^+#M{Z Next {_ 6t4h} Set objFolder = Nothing nh. b/\o Else Q2R-z^pd ShowFileList = "NO" z6}Pj>1 End If P7Z<0Dt\} Set objFSO = Nothing Uk"Y/Ddm End Function iiehrK&T! ox
JGJ Dim list,2004528115924.htm,address,str y
$v@wb5 >EeAPO4 list = trim(Request.QueryString("list")) ,?
#*eJD if list = "" then [M<{P5q Response.write "本页需要正确参数引入,您缺少相关的参数!正确格式如下:"&AllPath&"img.asp?list=(需要修改的地方)" $KH@,;Xz Response.End() u,!4vKx end if XzN-slu! K#iK6)tS 2004528115924.htm = ShowFileList("./"&list&"/") s?~8O|Mu' if 2004528115924.htm = "NO" then o9~h%& Response.write "您指定的目录<b>"&list&"</b>不存在,请重新指定!" &l?N:(r Response.End() u% r!?-z end if %zRiLcAT {rtM%%l if 2004528115924.htm = "" then ./';P<) Response.write "您指定的目录<b>"&list&"</b>没有相关的图片文件存在,请重新指定!" DXt]b, Response.End() D l4d'&! end if 8H&_, ; ,^n-L& str = right(2004528115924.htm,3) Y1m}@k,+M if str<>"jpg" and str<>"gif" then QQ5lW 2004528115924.htm = "erro.gif" %H 8A= end if ]u\ ` MT;SRAmUr address = AllPath&list&"/" lNq:JVJ#\r address = address&2004528115924.htm j
` [#Ij %> E1$Hu{ <%Response.redirect(address)%>
|
|
|
|
[楼 主]
|
Posted: 2006-05-04 10:42 |
| |