08-07
02
jsp防盗链
作者:Java伴侣 日期:2008-07-02
index.jsp
a.jsp页面
通过判断 referer, 判断你从哪里来。
复制内容到剪贴板 程序代码
<html>
<head><title>Simple jsp page</title></head>
<body>Place your content here
here is index jsp
get header info
<a href="a.jsp">a.jsp</a>
</body>
</html>
<head><title>Simple jsp page</title></head>
<body>Place your content here
here is index jsp
get header info
<a href="a.jsp">a.jsp</a>
</body>
</html>
a.jsp页面
通过判断 referer, 判断你从哪里来。
复制内容到剪贴板 程序代码
<html>
<head><title>Simple jsp page</title></head>
<body>Place your content here
here is a. jsp
get header info
<%=request.getHeader("Referer")%>
<%if(null == request.getHeader("Referer") || request.getHeader("Referer").indexOf("yourdomain.com") < 0){%>
不管你来自哪的,但做人要厚道
<%}else{%>
合法访问
<%}%>
</body>
</html>
<head><title>Simple jsp page</title></head>
<body>Place your content here
here is a. jsp
get header info
<%=request.getHeader("Referer")%>
<%if(null == request.getHeader("Referer") || request.getHeader("Referer").indexOf("yourdomain.com") < 0){%>
不管你来自哪的,但做人要厚道
<%}else{%>
合法访问
<%}%>
</body>
</html>
评论: 0 | 引用: 0 | 查看次数: 704
发表评论