Anti-theft

xiaoxiao2021-03-06  59

/ 0000: <% 0001: '**************************** 0002:' Write by: DLL0003: 'NetBuilder 出 0004 : 'File Name Use URL Parameters / Table Pass, Item Name is filename, direct output picture stream on GIF and JPG, other files will pop up download 0005:' ************ **************** 0006: on error resume next0007: response.buffer = true0008: response.clear0009: 0010: const hiddir = "../xbb2003dfsdada/" based on yours directory where the file modified 0011: 0012: SUB UseStream (FileName, FileNameString) 0013: Dim FileStream, file, FileContentType, IsAttachment0014: Set FileStream = Server.CreateObject ( "ADODB.Stream") 0015: FileStream.Open0016: FileStream.Type = 10017 : File = server.MapPath (FileName) 0018: FileStream.LoadFromFile (File) 0019: FileContentType = getContentType (FileName) 0020: If FileContentType <> "image / gif" And FileContentType <> "image / jpeg" Then0021: IsAttachment = " Attachment; "0022: else0023: isattachment =" 0024: end5025: response.addheader "content-disposition", isattachment & "filename =" & filenamestring0026: response.addheader "Content-length" Content-Length "Content-length ", FileStream.Size0027: Response.Charset =" UTF-8 "0028: Response.ContentType = FileContentType0029: Response.BinaryWrite FileStream.Read 0030: Response.Flush0031: 0032: FileStream.Close0033: Set FileStream = Nothing0034: End SUB0035: 0036 : Function getfilepath (filename, hiddenDir) 'Limit the function of the chain, when the domain name in the source address and the domain name of the current file address are different, the custom error image Noimg.gif is output, you can also set it to use the session limit 0037: DIM Server_v1, server_v20038: server_v1 = cstr (Request.ServerVariables) 0039: Server_v2 = cstr (Request.ServerVariables ("Server_Name"

)) 0040: 'IF server_v1 <> "" and MID (Server_v1,8, len (server_v2)) = server_v2 tellndir & filename0042:' else0043: 'getFilePath = "noimg.gif" 0044:' end iF0045: End function0046: 0047: Function getContentType (flname) 0048: Select Case Lcase (Right (Flname, 4)) 0049: Case ".asf" 0050: getContentType = "VIDEO / X-MS-ASF" 0051: Case ".avi" 0052: getContentType = "VIDEO / AVI" 0053: Case ".doc" 0054: getContentType = "Application / MSWORD" 0055: Case ".zip" 0056: getContentType = "Application / Zip" 0057: Case ".xls" 0058: GetContentType = "Application / VND.MS-Excel" 0059: Case ".gif" 0060: getContentType = "image / gif" 0061: case ".jpg", "jpeg" 0062: getContentType = "image / jpeg" 0063: CASE ".wav" 0064: getContentType = "AUDIO / WAV" 0065: Case ".mp3" 0066: getContentType = "AUDIO / MPEG3" 0067: Case ".mpg", "mpeg" 0068: getContentType = "VIDEO / MPEG" 0069: Case ".rtf" 0070: getContentType = "Application / RTF" 0071: Case ".htm", "html" 0072: getContentType = "text / html" 0073: case ".txt" 0074 : GetContentType = "text / plain" 0075: Case Else0076: getContentType = "Application / Oct-stream" 0077: End SELECT0078: End Function0079: 0080: DIM FileName, FilePath0081: filename =

转载请注明原文地址:https://www.9cbs.com/read-112252.html

New Post(0)