<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>
<%
----------------------------------------------------------------------------------------
Random Picture Display ****************************
Use instance: img.asp?list= Picture Storage Directory
Use Note: The picture catalogue is placed in the same directory as this file! Need FSO support!
Description: As long as the change picture in a directory, modify the following program (need to modify the place) into your directory name!
Upload this program and picture folder to the same directory, in the post use UBB code like: you Can!
----------------------------------------------------------------------------------------
Function Allpath ()
Dim Domain,gfilepath
Domain = Request.ServerVariables ("SERVER_NAME")
Gfilepath = Request.ServerVariables ("Path_info")
Gfilepath = LCase (Left (Gfilepath,instrrev (Gfilepath, "/"))
Allpath = "
http://"&domain&gfilepath 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 "This page needs the correct parameter introduction, you are missing the related parameter!" The correct format is as follows: "&AllPath&" img.asp?list= (where modifications are needed)
Response.End ()
End If
filename = Showfilelist ("./" &list& "/")
if filename = "NO" Then
Response.Write "The directory you specified <b>" &list& "</b> does not exist, please specify it again! "
Response.End ()
End If
if filename = "" Then
Response.Write "Your specified directory <b>" &list& "</b> no related picture files exist, please reassign! "
Response.End ()
End If
str = right (filename,3)
If str<> "JPG" and str<> "GIF" then
filename = "Erro.gif"
End If
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.