----------------------------------------------------
if InStr(Request.ServerVariables("HTTP_REFERER"),Request.ServerVariables("HTTP_HOST"))=0 then
Response.write("非法链接!")
Response.end
'Response.Redirect "index.htm"
end if
----------------------------------------------------
From_url = Cstr(Request.ServerVariables("HTTP_REFERER"))
Serv_url = Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(From_url,8,len(Serv_url)) <> Serv_url then
response.write "非法链接!" '防止盗链
response.end
end if
--------------------------------------------------
if InStr(Request.ServerVariables("HTTP_REFERER"),Request.ServerVariables("HTTP_HOST"))=0 then
Response.write("非法链接!")
Response.end
'Response.Redirect "index.htm"
end if
----------------------------------------------------
From_url = Cstr(Request.ServerVariables("HTTP_REFERER"))
Serv_url = Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(From_url,8,len(Serv_url)) <> Serv_url then
response.write "非法链接!" '防止盗链
response.end
end if
--------------------------------------------------
本文提供了两种使用VBScript检查HTTP_REFERER变量的方法来防止非法链接访问,通过比较来源URL与服务器名称确保请求的有效性。
840

被折叠的 条评论
为什么被折叠?



