跪 求 一段防盗链的ASP代码 高手帮忙

来源:百度知道 编辑:UC知道 时间:2024/06/27 23:08:04
当从某个指定的网站(如www.baidu.com)进入a.htm这个页面时,能够正常显示,当从其他网站进入a.htm这个页面,时自动跳转到b.htm
参考代码: 哪位高人帮忙改改
<%
From_url = Cstr(Request.ServerVariables("HTTP_REFERER"))
Serv_url = Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(From_url,8,len(Serv_url)) <> Serv_url and mid(From_url,8,len(Serv_url))<>"net235.com" and mid(From_url,8,len(Serv_url))<>"xz.net235.com" then
response.write "您下载的软件来自..,请直接从主页下载,谢谢<br>" '防止盗链
response.write "<a href=http://xz.net235.com>....
http://www.hnlanling.com/vbbs</a>" '防止盗链
response.end
end if
%>

如果是自己的程序.那么.你可以在页面转向的时候.
传一个值走.比如"xxx.asp?action=1"
那边接受的时候
if request("action")<>1 then
response.write"<script>alert('请走正门!');location='b.htm';</script>"
response.end
end if