WEB开发网
开发学院WEB开发Jsp jsp防盗链 阅读

jsp防盗链

 2007-03-20 16:34:41 来源:WEB开发网   
核心提示:index.jsp-<html> <head><title>Simple jsp page</title></head> <body>Place your content here here is index jsp get header

index.jsp

-----------------------------

<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>

Tags:jsp 防盗

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接