|
- <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
- <%
- Function AllPath()
- Dim Domain,GFilePath
- Domain = Request.ServerVariables("SERVER_NAME")
- GFilePath = Request.ServerVariables("PATH_INFO")
- GFilePath = lcase(left(GFilePath,instrRev(GFilePath,"/")))
- AllPath = "http://www.w16888.com/" //唯一需要修改的地方,你的图片目录如果是在http://xxxx/myfile/angie/pic,这里就写http://xxx.com/myfile/angie/ ;
- End Function
- Function ShowFileList(folderspec)
- Dim Path,objFSO,objFolder,count,objFile,nume,S
- Path = Server.MapPath(folderspec)
- Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
- If objFSO.FolderExists(Path) Then
- Set objFolder = objFSO.GetFolder(Path)
- count = 0
- For Each objFile in objFolder.Files
- count = count+1
- Next
- randomize
- nume = Int((count*rnd)+1)
- S = 0
- ShowFileList = ""
- For Each objFile in objFolder.Files
- S = S + 1
- If S = nume Then
- ShowFileList = objFile.Name
- Exit For
- End If
- Next
- Set objFolder = Nothing
- Else
- ShowFileList = "NO"
- End If
- Set objFSO = Nothing
- End Function
- Dim list,filename,address,str
- list = trim(Request.QueryString("list"))
- if list = "" then
- Response.write "本页需要正确参数引入,您缺少相关的参数!正确格式如下:"&AllPath&"xxxxxx.asp?list=xxxxxx.jpg"
- Response.End()
- end if
- filename = ShowFileList("./"&list&"/")
- if filename = "NO" then
- Response.write "您指定的目录<b>"&list&"</b>不存在,请重新指定!"
- Response.End()
- end if
- if filename = "" then
- Response.write "您指定的目录<b>"&list&"</b>没有相关的图片文件存在,请重新指定!"
- Response.End()
- end if
- str = right(filename,3)
- if str<>"jpg" and str<>"gif" then
- filename = "erro.gif"
- end if
- address = AllPath&list&"/"
- address = address&filename
- %>
- <%Response.redirect(address)%>
- 把这段代码保存为im.asp
- 把美女图片放在pic文件夹下,把pic文件夹和im.asp放在网站根目录下,在浏览器里打开演
复制代码
[ 本帖最后由 tcbxh2008 于 2007-6-3 16:47 编辑 ] |
|