拱北汽车站有哪个:网页高手请进

来源:百度文库 编辑:神马品牌网 时间:2024/05/05 07:16:42
请哪位仁兄帮我翻译一下这些代码.谢谢~

<%@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://"&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 "本页需要正确参数引入,您缺少相关的参数!正确格式如下:"&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)%>

--------------------------------------------------------------------------------
pic.asp?list=girl&fname=3.jpg
'使用实例:img.asp?list=图片存放目录
xxxxxx.asp?list=xxxxxx.jpg"

xxxxxx.asp所存成的文件名 xxxxxx.jpg 文件夹

--------------------------------------------------------------------------------
<%Dim num
Randomize
num=Int(10 * Rnd +1)
response.write "<img src="&num&".gif />"
%>

这是一个上传图片的验证程序(.asp)

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 "本页需要正确参数引入,您缺少相关的参数!正确格式如下:"&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
%>

定义清单,文件名,地址信息
中间是验证出错信息

str = right(filename,3)
if str<>"jpg" and str<>"gif" then
filename = "erro.gif"
end if

这是判断图片格式(就是扩展名)
if str<>"jpg" and str<>"gif" then
意思是除了“JPG”和“GIF”的图片,其它都为错

悬赏太少了吧?
这可是要死人的

这样好了
把它复制到 制作网页软件的 HTML 选项里看看吧~~