加入收藏 | 设为首页 | 会员中心 | 我要投稿 银川站长网 (https://www.0951zz.com/)- 云通信、基础存储、云上网络、机器学习、视觉智能!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

如何防止在 ASP 页面中的数据被采集

发布时间:2023-10-17 12:36:23 所属栏目:Asp教程 来源:
导读:自己写了一段防小偷采集的代码,与大家交流交流!用法:单独保存一个文件如(no.asp);在相应的asp页面头部用<!--#include file="no.asp" -->加入即可!<%&#39;****************************************&#39;* 网页防采集

自己写了一段防小偷采集的代码,与大家交流交流!

用法:

单独保存一个文件如(no.asp);

在相应的asp页面头部用<!--#include file="no.asp" -->加入即可!

<%

'****************************************

'* 网页防采集实现 *

'****************************************

dim onlyURL,from

'***指定来源网址...

onlyURL="/"

from=trim(request.serverVariables("HTTP_REFERER"))

if from="" then

'***来源为空:可能直接输入网址或小偷...

response.write "<div style='display:none'><p>拒绝小偷!!!"

response.write "<p>来自:" & from

response.write "<p>请访问:<a href='" & onlyURL & "'>" & onlyURL &"</a>"

response.write "<p><form name='blankForm' method=get action=''></form>"

response.write "<p><script language=""JavaScript"">blankForm.submit()</script>" & vbCRLF

response.end

else

if inStr(from,onlyURL)<>1 then

'***非指定来源:盗链...

response.write "<div style='display:none'><p>拒绝盗链!!!"

response.write "<p>来自:" & from

response.write "<p>请访问:<a href='" & onlyURL & "'>" & onlyURL &"</a>"

response.write "<p><form name='blankForm' method=get action=''></form>"

response.write "<p><script language=""JavaScript"">blankForm.submit()</script>"

response.end

else

'***来源正常,将访问后面的内容...

end if

end if

%>

(编辑:银川站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章