13 Aug.2009

盗链163、百度、QQ空间图片 不指定

Added by: admin   Categories:时下趣闻   FromOriginal       Large | Medium | Small
收藏到网摘:

有时在BBS上面发帖子时要引用一些来自163、百度、QQ空间等的图片,像这些比较大一点的相册站,一般都会加上防盗链,他会检测图片请求的来源。如果来源不是本站,就会显视成特定的图片如:
百度相册 右边这个图就是使用的这个功能所显视出来的原图
163相册或博客
它就不会显视原来的图片。好了破解方法如下:(来源网络)

使用 http://www.iqshw.com/tu.asp?url=
再加图片地址 就可以正常使用,而没有盗链提示了

另外附上一个ASp程序。就是上面这个连接中tu.asp中的源码把它保存为PIC.asp传到你的空间就可以用了。 方法http://你的域名/pic.asp?url=这里改成图片地址就可以了 他还可以用在别的网站有防盗链图片中

ASP/Visual Basic代码
  1. <%
  2. '盗链判断
  3. Dim url, body, myCache
  4. url = Request.QueryString("url")
  5. Set myCache = new cache
  6. myCache.name = "picindex"&url
  7. If myCache.valid Then
  8. body = myCache.value
  9. Else
  10. body = GetWebData(url)
  11. myCache.add body,dateadd("d",1,now)
  12. End If
  13. If Err.Number = 0 Then
  14. Response.CharSet = "UTF-8"
  15. Response.ContentType = "application/octet-stream"
  16. Response.BinaryWrite body
  17. Response.Flush
  18. Else
  19. Wscript.Echo Err.Description
  20. End if
  21. '取得数据
  22. Public Function GetWebData(ByVal strUrl)
  23. Dim curlpath
  24. curlpath = Mid(strUrl,1,Instr(8,strUrl,"/"))
  25. Dim Retrieval
  26. Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
  27. With Retrieval
  28. .Open "Get", strUrl, False,"",""
  29. .setRequestHeader "Referer", curlpath
  30. .Send
  31. GetWebData =.ResponseBody
  32. End With
  33. Set Retrieval = Nothing
  34. End Function
  35. 'cache类
  36. class Cache
  37. private obj 'cache内容
  38. private expireTime '过期时间
  39. private expireTimeName '过期时间application名
  40. private cacheName 'cache内容application名
  41. private path 'url
  42. private sub class_initialize()
  43. path=request.servervariables("url")
  44. path=left(path,instrRev(path,"/"))
  45. end sub
  46. private sub class_terminate()
  47. end sub
  48. public property get blEmpty
  49. '是否为空
  50. if isempty(obj) then
  51. blEmpty=true
  52. else
  53. blEmpty=false
  54. end if
  55. end property
  56. public property get valid
  57. '是否可用(过期)
  58. if isempty(obj) or not isDate(expireTime) then
  59. valid=false
  60. elseif CDate(expireTime)<now then
  61. valid=false
  62. else
  63. valid=true
  64. end if
  65. end property
  66. public property let name(str)
  67. '设置cache名
  68. cacheName=str & path
  69. obj=application(cacheName)
  70. expireTimeName=str & "expires" & path
  71. expireTime=application(expireTimeName)
  72. end property
  73. public property let expires(tm)
  74. '重设置过期时间
  75. expireTime=tm
  76. application.lock
  77. application(expireTimeName)=expireTime
  78. application.unlock
  79. end property
  80. public sub add(var,expire)
  81. '赋值
  82. if isempty(var) or not isDate(expire) then
  83. exit sub
  84. end if
  85. obj=var
  86. expireTime=expire
  87. application.lock
  88. application(cacheName)=obj
  89. application(expireTimeName)=expireTime
  90. application.unlock
  91. end sub
  92. public property get value
  93. '取值
  94. if isempty(obj) or not isDate(expireTime) then
  95. value=null
  96. elseif CDate(expireTime)<now then
  97. value=null
  98. else
  99. value=obj
  100. end if
  101. end property
  102. public sub makeEmpty()
  103. '释放application
  104. application.lock
  105. application(cacheName)=empty
  106. application(expireTimeName)=empty
  107. application.unlock
  108. obj=empty
  109. expireTime=empty
  110. end sub
  111. public function equal(var2)
  112. '比较
  113. if typename(obj)<>typename(var2) then
  114. equal=false
  115. elseif typename(obj)="Object" then
  116. if obj is var2 then
  117. equal=true
  118. else
  119. equal=false
  120. end if
  121. elseif typename(obj)="Variant()" then
  122. if join(obj,"^")=join(var2,"^") then
  123. equal=true
  124. else
  125. equal=false
  126. end if
  127. else
  128. if obj=var2 then
  129. equal=true
  130. else
  131. equal=false
  132. end if
  133. end if
  134. end function
  135. end class
  136. %>

作者:admin@戏梦
地址:http://www.58iz.cn/read.php/79.htm
版权所有©转载时必须以链接形式注明作者和原始出处及本声明!

Time:19:42 Comments(0) Trackbacks(0) Reads(303) Tags: , , , ,