zoukankan      html  css  js  c++  java
  • ASP防止盗链的一段代码

    <%@Language="vbscript"%>
    <%
    Response.Buffer = true
    Response.Expires = -1441
    
    ' variables
    dim ref : ref=Request.ServerVariables("HTTP_REFERER")
    dim arrReferer : arrReferer = split(ref, "/")
    dim imgName, strDomain, strDirectory, strImage, strAntiLeech
    
    ' assign variables
    strDomain = "http://www.xxxx.net"
    strDirectory = "/"
    
    ' assign variables
    strAntiLeech = "anti-leech.jpg"
    strImage = request.querystring("img")
    
    if ref > "" then
    ref = arrReferer(2) 
    end if
    
    if request.querystring("img") <> "" then
    
    if ref = "localhost" or ref = strDomain or ref = "www." & strDomain then
    imgname = strDirectory & strImage
    else
    imgName = strDirectory & strAntiLeech
    end if
    
    else
    
    imgName = strDirectory & strAntiLeech
    
    end if
    
    dim objStream
    set objStream = server.CreateObject("ADODB.Stream")
    objStream.Type = 1
    objStream.Open()
    objStream.loadFromFile(Server.MapPath(imgName))
    
    Response.ContentType = "image/gif"
    Response.BinaryWrite(objStream.Read())
    
    objStream.close()
    set objstream = nothing
    
    %>上面代码保存为a.asp
    <img src="a.asp" border="0" /> 
    

      

  • 相关阅读:
    K8s环境搭建
    opencv一些重要的函数或者类
    opencv的点的表示
    opencv矩阵的格式输出
    opencv矩阵运算(二)
    opencv矩阵运算(一)
    如何安装指定版本的Kubernetes
    使用minikube快速部署k8s集群
    Ceph 存储集群
    学习tcpIp必备的抓包工具wireshark
  • 原文地址:https://www.cnblogs.com/uuxanet/p/3282683.html
Copyright © 2011-2022 走看看