ASP二进制流方法隐藏图片文件真实地址
以下是引用片段:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Option Explicit
Const SysUrl=""
Function ReadBinFile(fileName)
Dim objStream,bin
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile fileName
bin = objStream.Read
objStream.Close
ReadBinFile = bin
End Function
Function isSelfRefer()
Dim sHttp_Referer, sServer_Name
sServer_Name = CStr(Request.ServerVariables("HTTP_REFERER"))
if instr(sServer_Name,"80boby.com")<>0 or instr(sServer_Name,"freeat63.cn")<>0 then
IsSelfRefer = True
Else
IsSelfRefer = False
End If
End Function
if request.QueryString("Mark")="getPic" then
Dim RealUrl,fso
Dim uFileName:uFileName=Request.QueryString("x")
RealUrl=Server.MapPath("文件真实路径"&uFileName)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if Not(fso.FileExists(RealUrl)) then RealUrl=Server.MapPath("logo.gif")
if Not(isSelfRefer) then
RealUrl=Server.MapPath("logo.gif")
end if
response.contenttype = "image/jpeg"
response.BinaryWrite ReadBinFile(RealUrl)
response.end
end if
%>