用Asp隱藏檔案路徑實現防盜煉

2021-04-16 12:16:39 字數 2155 閱讀 7171

示例**:

response.write "非法鏈結!" '防止盜鏈

response.end

end if

if request.cookies("logined")="" then

response.redirect "/login.asp" '需要登陸!

end if

function getfilename(longname)'/folder1/folder2/file.asp=>file.asp

while instr(longname,"/")

longname = right(longname,len(longname)-1)

wend

getfilename = longname

end function

dim stream

dim contents

dim filename

dim truefilename

dim fileext

const adtypebinary = 1

filename = request.querystring("filename")

if filename = "" then

response.write "無效檔名!"

response.end

end if

fileext = mid(filename, instrrev(filename, ".") + 1)

select case ucase(fileext)

case "asp", "asa", "aspx", "asax", "mdb"

response.write "非法操作!"

if lcase(right(filename,3))="pdf" then '設定pdf型別檔案目錄

truefilename = "/the_pdf_file_s/"&filename

end if

if lcase(right(filename,3))="doc" then '設定doc型別檔案目錄

truefilename = "/all_images_/"&filename '設定影象檔案目錄

end if

while not stream.eos

response.binarywrite stream.read(1024 * 64)

wend

stream.close

set stream = nothing

response.flush

response.end

%> 

用Asp隱藏檔案路徑,實現防盜煉

用asp隱藏檔案路徑,實現防盜煉 示例 response.write 非法鏈結!防止盜鏈 response.end end if if request.cookies logined then response.redirect login.asp 需要登陸!end if function getf...

用Asp隱藏檔案路徑實現防盜煉

示例 response.write 非法鏈結!防止盜鏈 response.end end if if request.cookies logined then response.redirect login.asp 需要登陸!end if function getfilename longname ...

用Asp隱藏檔案路徑實現防盜煉

示例 response.write 非法鏈結!防止盜鏈 response.end end if if request.cookies logined then response.redirect login.asp 需要登陸!end if function getfilename longname ...